在Java 7中使用AspectJ AOP时出错

Mik*_*aev 23 spring aspectj java-7

我已经将Java更新为版本"1.7.0_09-icedtea"(以前它是1.6)并获得以下消息:

Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate be
an class [org.springframework.aop.aspectj.AspectJPointcutAdvisor]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: error the 
@annotation pointcut expression is only supported at Java 5 compliance level or above
Run Code Online (Sandbox Code Playgroud)

应用程序已使用java 1.6编译,编译器合规性级别也设置为1.6.我正在使用spring 3.1.0

有没有人能够在Java 7下使用aspectj?

Jay*_*Jay 34

AspectJ 1.5.4不适用于Java7.尝试将您的AspectJ版本升级到1.7.0或更高版本(截至撰写本文时,最新版本为1.7.2).

(之前我也有过AspectJ/Java7问题)

  • 他们在1.6.12 M2中引入了_Java7编织支持.但完全支持仅来自1.7.0 RC 1,错误在1.7.1中修复,因此建议最新的1.7.2.请参阅发行说明:http://www.eclipse.org/aspectj/doc/released/README-1612.html http://www.eclipse.org/aspectj/doc/released/README-170.html (3认同)