org.aspectj.lang.NoAspectBoundException - method <init>()V not found

房东的猫 提交于 2019-12-11 02:56:11

问题


I had same problem as vanhre asked in Spring forum, but in my case I couldn't change the constructor.

I'm using Spring java configuration, so it was initializing ok during jetty start, but in runtime, when I executed the functionality with my aspect it failed with exactly the same exception from the forum.


回答1:


I found later, that I need aspectjrt dependency in my pom.

<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjrt</artifactId>
    <version>1.6.12</version>
</dependency>

edit: Missing dependency was an error, but real problem is Eclipse + aspects combination. When I used Eclipse to build my aspect class this error occurred. Additionally when I compiled class the aspect advice was for, aspect was not called.

solution: you have to use maven to build your application (I'd be glad if someone find solution for Eclipse, because I'm sure I'll forget this)




回答2:


download http://central.maven.org/maven2/org/aspectj/aspectjrt/1.6.9/aspectjrt-1.6.9.jar and add to your project



来源:https://stackoverflow.com/questions/13289065/org-aspectj-lang-noaspectboundexception-method-initv-not-found

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