Easymock3 Spring4.0.0.RELEASE cglib兼容性 [英] Easymock3 Spring4.0.0.RELEASE cglib compatibility
问题描述
我按照此处给出的建议尝试使用spring进行一些单元测试启用aop的方法。但是,我怀疑spring-core下的重新打包的cglib类和cglib-nodep-2.2.jar相互冲突,导致类加载器将我的类代理两次加载。这将导致以下错误:
I followed the advice given here to try some unit tests with spring aop enabled methods. However, I suspect that the repackaged cglib classes under spring-core and the cglib-nodep-2.2.jar conflict with each other, causing my class being proxied to be loaded by the classloader twice. This results in the following error:
Caused by: java.lang.LinkageError: loader (instance of sun/misc/Launcher$AppClassLoader): attempted duplicate class definition for name:
工具:
- easmock-3.0(具有cglib-nodep-2.2.jar传递依赖项)
- spring-x- 4.0.0.RELEASE(带有重新包装的cglib版本的?类)
- junit-4.8.1
排除可传递的cglib-nodep依赖性显然无济于事-所有测试,包括非sing-aop的测试也都开始失败。
Excluding the transitive cglib-nodep dependency didn't help obviously - all tests including non-sring-aop ones started failing too.
我也尝试过在此处发布的答案:清理
I tried the answer posted here too: cleaning up the target folder before running the tests again with no success.
这个问题真的是因为cglib版本冲突,就像我想的那样吗?如果是这样,我应该使用什么正确的版本来停止加载我的类两次?
Is this problem really because of the conflict of cglib versions like I thought it would be? If so, what is the right version I should use that would stop loading my class twice.
推荐答案
<properties>
<java.version>1.7</java.version>
<spring.version>4.0.3.RELEASE</spring.version>
<cglib.version>2.2.2</cglib.version>
</properties>
这篇关于Easymock3 Spring4.0.0.RELEASE cglib兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!