测试基于JAVA配置的SPRING报错

我相信,碰到不认识的异常后,很多人都会有一种莫名的害怕,尤其是领导站在你身后时!

我们为什么害怕,因为我们不知!不是我人不会!所以学会就好了。

对于异常的解决方法:

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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值