解决spring 和 hibernate 的冲突的方法就是用cglib-nodep-2.1_3.jar 替换cglib-2.1_3.jar ,且他们不能同时存在。
用maven开发时,打包后他们2都到lib下去了,可以手工剔除,但很麻烦。也这样不利于我们项目的自动化测试。
在贴吧中找到了一个方法,解决了这个问题。
请看下面的代码
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.1_3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.1_3</version>
</dependency>
很优雅吧!
参考贴吧 how can exclude a jar in WEB-INF/lib