Defensive handling of incompatible advice methods
This covers AspectJ transaction and caching aspects when encountered by Spring AOP. Closes gh-32882 See gh-32793
This commit is contained in:
parent
73eb6f0660
commit
6d7cd9c7dc
|
@ -213,9 +213,17 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
return new InstantiationModelAwarePointcutAdvisorImpl(expressionPointcut, candidateAdviceMethod,
|
return new InstantiationModelAwarePointcutAdvisorImpl(expressionPointcut, candidateAdviceMethod,
|
||||||
this, aspectInstanceFactory, declarationOrderInAspect, aspectName);
|
this, aspectInstanceFactory, declarationOrderInAspect, aspectName);
|
||||||
}
|
}
|
||||||
|
catch (IllegalArgumentException | IllegalStateException ex) {
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("Ignoring incompatible advice method: " + candidateAdviceMethod, ex);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private AspectJExpressionPointcut getPointcut(Method candidateAdviceMethod, Class<?> candidateAspectClass) {
|
private AspectJExpressionPointcut getPointcut(Method candidateAdviceMethod, Class<?> candidateAspectClass) {
|
||||||
|
|
|
@ -2,15 +2,21 @@
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||||
|
xmlns:cache="http://www.springframework.org/schema/cache"
|
||||||
xmlns:context="http://www.springframework.org/schema/context"
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||||
http://www.springframework.org/schema/aop https://www.springframework.org/schema/aop/spring-aop-2.0.xsd
|
http://www.springframework.org/schema/aop https://www.springframework.org/schema/aop/spring-aop-2.0.xsd
|
||||||
|
http://www.springframework.org/schema/cache https://www.springframework.org/schema/cache/spring-cache-3.1.xsd
|
||||||
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context-2.5.xsd">
|
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context-2.5.xsd">
|
||||||
|
|
||||||
<aop:aspectj-autoproxy/>
|
<aop:aspectj-autoproxy/>
|
||||||
|
|
||||||
<context:spring-configured/>
|
<context:spring-configured/>
|
||||||
|
|
||||||
|
<cache:annotation-driven mode="aspectj"/>
|
||||||
|
|
||||||
|
<bean id="cacheManager" class="org.springframework.cache.support.NoOpCacheManager"/>
|
||||||
|
|
||||||
<bean id="myAspect" class="org.springframework.aop.aspectj.autoproxy.CodeStyleAspect" factory-method="aspectOf">
|
<bean id="myAspect" class="org.springframework.aop.aspectj.autoproxy.CodeStyleAspect" factory-method="aspectOf">
|
||||||
<property name="foo" value="bar"/>
|
<property name="foo" value="bar"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
Loading…
Reference in New Issue