我相信,碰到不认识的异常后,很多人都会有一种莫名的害怕,尤其是领导站在你身后时!
我们为什么害怕,因为我们不知!不是我人不会!所以学会就好了。
对于异常的解决方法:
1、先简单看明白提示的意思
2、猜!
好吧,第二步比较龌龊,但管用啊!爱迪生发明灯泡时,不也是猜出来的吗!
先猜,再实践,是解决问题的不错方法哦。
那我们看一下红字部分,当我第一眼看到“CGLIB”时,还以为是“MLGB”呢,心想:我操,国外人也会汉语拼音!
英语不好也没事,猜嘛,红字的大概意思如下
运行@Configuration classes时需要CGLIB,(想解决问题)要么把CGLIB放在classpath下,要么把springIdolConfig上的@Configuration bean 声明删除
那么CGLIB到底是什么东西啊?还得猜,我搭眼一看,这里有“LIB”,所以可能是一个JAR包
上网一搜,找到了“cglib-2.2.2.jar”,导入后,虽然如下错不报了,但报另外一个错误。
怎么办,猜啊,这里就不细说了,最后还是连猜带搜索,在网上找到了“cglib-nodep-2.2.jar”,导入后,运行正常!
此JAR包下载地址如下,解压密码:7
http://download.csdn.net/detail/gxlstone/6415845
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: [springIdolConfig]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:232)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:163)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:663)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:602)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.springinaction.common.BaseBeanFactory.getBean(BaseBeanFactory.java:11)
at com.springinaction.springidol.ConfigMain.main(ConfigMain.java:13)