cglib编译器jdk合规性
我在同事的盒子上收到一个奇怪的错误。 CGLib 正在自动代理 Spring AOP 日志记录的服务类,并且在运行时它会显示“未解决的编译错误:必须通过 cglib 代理类在 fastclass 上覆盖超类方法”。
在有问题的类中,我在以下情况下使用 @override 注释:我实现了一个接口,并且我知道它在 jdk 1.6 中受支持,但 CGLib 会自动代理该实现类。
但是,它在我的 jdk_1.6_17 机器上运行良好,但在他的 jdk_1.6_10 机器上
则 不然。但是,他可以使用maven正确编译项目,maven使用相同的jdk。 删除 @Override 注释可以修复运行时 cglib 错误,但这很奇怪,对吧?
cglib 使用什么编译器进行自动代理,这可能是 jdk_1.6_10 中的错误还是我还缺少其他内容?
基本上使用spring 3.0.4,jboss 5.10,spring security 3.0.3
,该类在spring-security中实现AuthenticationUserDetailsService。
有问题的方法签名:
@Override
public UserDetails loadUserDetails(Authentication auth) throws UsernameNotFoundException;
UserDetails 是一个 spring-security 接口,Authentication 也是如此。
I'm getting a strange error on a colleague's box. CGLib is auto-proxying a service class for spring AOP logging, and at runtime it says 'unresolved compilation error: must override a superclass method" on the fastclass by cglib proxy class.
In the offending class, I'm using @override annotations when I implement an interface, and I know that it's supported in jdk 1.6 but not 1.5. CGLib is auto-proxying that implementation class.
However, it works fine on my box with jdk_1.6_17, but not on his with jdk_1.6_10.
However however, he can compile the project correctly using maven, which uses the same jdk.
Removing the @Override annotation fixes the runtime cglib error, but that's weird right?
What compiler does cglib use for its auto-proxying, and could this be a bug in jdk_1.6_10 or is there something else I'm missing?
Using spring 3.0.4, jboss 5.10, spring security 3.0.3
basically, the class implements AuthenticationUserDetailsService in spring-security.
The offending method signature:
@Override
public UserDetails loadUserDetails(Authentication auth) throws UsernameNotFoundException;
UserDetails is a spring-security interface, and so is Authentication.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,想通了。我明确地将 cglib 2.2 引入到 pom.xml 中,而 spring-flex 引入了 2.1_03,这是 2005 年的版本。出于某种原因,我的盒子最终使用了新的,而我的同事最终使用了旧的。
有人知道为什么首先加载特定的一个吗?
Ok, figured it out. I had explicity brought in cglib 2.2 into the pom.xml, and spring-flex was bringing in 2.1_03, which is from 2005. For some reason, my box ended up using the new one, and my colleague's ended up using the old.
Anyone know why a particular one gets loaded first?