我正在尝试向自己的方法之一添加@Retryable
注释,由于我无法使用@Configuration
类,因此我在春季<beans>
中使用xml来完成此操作,如下所示:
<context:annotation-config />
<aop:aspectj-autoproxy />
<bean id="retryAdvice"
class="org.springframework.retry.interceptor.RetryOperationsInterceptor"/>
我的应用程序抱怨Pointcut
不可用
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Pointcut
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562)
Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Pointcut
at org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory.<clinit>(AbstractAspectJAdvisorFactory.java:62)
Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.annotation.Pointcut
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
但根据maven,它在我的类路径中,作为aspectjweaver
1.8.9的一部分
# mvn dependency:tree
[INFO] +- org.springframework.retry:spring-retry:jar:1.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:4.3.22.RELEASE:compile
[INFO] | \- org.springframework:spring-beans:jar:4.3.22.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:4.3.22.RELEASE:compile
[INFO] +- org.springframework:spring-aspects:jar:4.3.22.RELEASE:compile
[INFO] | \- org.aspectj:aspectjweaver:jar:1.8.9:compile
如您所见,我使用的是Spring 4.3.22,但似乎添加spring-aspects
作为依赖项不足以使spring-retry
正常工作,即使它拉了aspectjweaver
。我想念什么吗?