Am using Spring 3.1. War is not built using Maven. Its just a normal build.
I have below jars in my class path.
antlr-runtime-3.0.1.jar
commons-logging-1.1.1.jar
org.apache.commons.logging.jar
org.springframework.aop-3.1.0.M2.jar
org.springframework.asm-3.1.0.M2.jar
org.springframework.aspects-3.1.0.M2.jar
org.springframework.beans-3.1.0.M2.jar
org.springframework.context-3.1.0.M2.jar
org.springframework.context.support-3.1.0.M2.jar
org.springframework.core-3.1.0.M2.jar
org.springframework.core-3.1.0.RELEASE.jar
org.springframework.core.jar
org.springframework.expression-3.1.0.M2.jar
spring-beans-3.0.5.RELEASE.jar
spring-context-3.0.5.RELEASE.jar
I have below code,
@Configuration
public class AppConfig {
@Bean(name="helloBean")
public HelloWorld helloWorld()
{
return new HelloWorldImpl();
}
}
When I run main
method, am getting below exception
Exception in thread "main" java.lang.IllegalStateException: CGLIB is required to process @Configuration classes. Either add CGLIB to the classpath or remove the following @Configuration bean definitions: [appConfig]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:297)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigurationClasses(ConfigurationClassPostProcessor.java:200)
To overcome this, if I add cglib-2.1.jar
, am getting below exception..
java.lang.ClassNotFoundException: org.objectweb.asm.Type
To overcome this, if I add asm3.1.jar
, am getting below exception.
java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.
How can I overcome my initial exception - CGLIB is required to process @Configuration classes ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…