Error when using AspectJ AOP with Java 7

有些话、适合烂在心里 提交于 2019-12-17 19:17:43

问题


I've updated Java to version "1.7.0_09-icedtea" (previously it was 1.6) and get the following message:

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

Application had been compiled with java 1.6 and compiler compliance level was set to 1.6 as well. I'm using spring 3.1.0

Has anyone been able to get aspectj working under Java 7?


回答1:


AspectJ 1.5.4 is not designed to work with Java7. Try upgrading your version of AspectJ to 1.7.0 or higher (latest was 1.7.2 as of this writing).

(I had AspectJ/Java7 issues before, too)




回答2:


If you are getting this error. just compile your program with jdk 1.6 and run it with jre 6. It will resolve your problem



来源:https://stackoverflow.com/questions/15678417/error-when-using-aspectj-aop-with-java-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!