Spring 将AspectJ AOP与Java 7一起使用时出错

Spring 将AspectJ AOP与Java 7一起使用时出错,spring,aspectj,java-7,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]: Constr

我已将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
应用程序是用Java1.6编译的,编译器遵从性级别也设置为1.6。我正在使用Spring3.1.0


有人能让aspectj在Java7下工作吗?

aspectj 1.5.4不是设计用于Java7的。尝试将您的AspectJ版本升级到1.7.0或更高版本(撰写本文时的最新版本是1.7.2)


(我以前也有过)

如果您遇到此错误。只需使用JDK1.6编译程序并使用JRE6运行即可。
它将解决您的问题

您使用的是哪一版本的aspectj?我将aspectjweaver版本更改为1.6.12,现在工作正常。他们在1.6.12 M2中引入了Java7编织支持。但是完全支持只来自1.7.0 RC 1,错误在1.7.1中得到修复,因此建议使用最新的1.7.2。请参阅发行说明: