java org.aspectj.lang.NoAspectBoundException - 方法 <init>()V 未找到
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13289065/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
org.aspectj.lang.NoAspectBoundException - method <init>()V not found
提问by Betlista
I had same problem as vanhre asked in Spring forum, but in my case I couldn't change the constructor.
我遇到了与vanhre 在 Spring 论坛中提出的问题相同的问题,但就我而言,我无法更改构造函数。
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.
我正在使用 Spring java 配置,所以它在码头启动期间初始化正常,但在运行时,当我用我的方面执行功能时,它失败了,与论坛中的异常完全相同。
回答by Betlista
I found later, that I need aspectjrt
dependency in my pom.
后来我发现,aspectjrt
我的 pom.xml 中需要依赖。
<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.
编辑:缺少依赖项是一个错误,但真正的问题是 Eclipse + 方面的组合。当我使用 Eclipse 构建我的方面类时,发生了这个错误。此外,当我编译类时,方面建议是针对的,方面没有被调用。
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)
解决方案:您必须使用 maven 来构建您的应用程序(如果有人为 Eclipse 找到解决方案,我会很高兴,因为我确定我会忘记这一点)
回答by adramazany
download http://central.maven.org/maven2/org/aspectj/aspectjrt/1.6.9/aspectjrt-1.6.9.jarand add to your project
下载 http://central.maven.org/maven2/org/aspectj/aspectjrt/1.6.9/aspectjrt-1.6.9.jar并添加到您的项目中