Test status quo for invocation order of all advice types
Prior to this commit we did not have tests in place to verify the status quo for the invocation order of all advice types when declared within a single aspect, either via the <aop:aspect> XML namespace or AspectJ auto-proxy support. This commit introduces such tests that demonstrate where such ordering is broken or suboptimal. The only test for which the advice invocation order is correct or at least as expected is the afterAdviceTypes() test method in ReflectiveAspectJAdvisorFactoryTests, where an AOP proxy is hand crafted using ReflectiveAspectJAdvisorFactory without the use of Spring's AspectJPrecedenceComparator. See gh-25186
This commit is contained in:
@@ -7,14 +7,16 @@
|
||||
|
||||
<bean id="echo" class="org.springframework.aop.config.AopNamespaceHandlerAdviceOrderIntegrationTests$Echo"/>
|
||||
|
||||
<bean id="echoAspect" class="org.springframework.aop.config.AopNamespaceHandlerAdviceOrderIntegrationTests$EchoAspect" />
|
||||
<bean id="invocationTrackingAspect" class="org.springframework.aop.config.AopNamespaceHandlerAdviceOrderIntegrationTests$InvocationTrackingAspect" />
|
||||
|
||||
<aop:config>
|
||||
<aop:aspect id="echoAdvice" ref="echoAspect">
|
||||
<aop:aspect id="echoAdvice" ref="invocationTrackingAspect">
|
||||
<aop:pointcut id="echoMethod" expression="execution(* echo(*))" />
|
||||
<aop:around method="around" pointcut-ref="echoMethod" />
|
||||
<aop:before method="before" pointcut-ref="echoMethod" />
|
||||
<aop:after method="after" pointcut-ref="echoMethod" />
|
||||
<aop:after-throwing method="failed" pointcut-ref="echoMethod" />
|
||||
<aop:after-returning method="succeeded" pointcut-ref="echoMethod" />
|
||||
<aop:after-throwing method="afterThrowing" pointcut-ref="echoMethod" />
|
||||
<aop:after-returning method="afterReturning" pointcut-ref="echoMethod" />
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
|
||||
@@ -7,13 +7,15 @@
|
||||
|
||||
<bean id="echo" class="org.springframework.aop.config.AopNamespaceHandlerAdviceOrderIntegrationTests$Echo"/>
|
||||
|
||||
<bean id="echoAspect" class="org.springframework.aop.config.AopNamespaceHandlerAdviceOrderIntegrationTests$EchoAspect" />
|
||||
<bean id="invocationTrackingAspect" class="org.springframework.aop.config.AopNamespaceHandlerAdviceOrderIntegrationTests$InvocationTrackingAspect" />
|
||||
|
||||
<aop:config>
|
||||
<aop:aspect id="echoAdvice" ref="echoAspect">
|
||||
<aop:aspect id="echoAdvice" ref="invocationTrackingAspect">
|
||||
<aop:pointcut id="echoMethod" expression="execution(* echo(*))" />
|
||||
<aop:after-returning method="succeeded" pointcut-ref="echoMethod" />
|
||||
<aop:after-throwing method="failed" pointcut-ref="echoMethod" />
|
||||
<aop:around method="around" pointcut-ref="echoMethod" />
|
||||
<aop:before method="before" pointcut-ref="echoMethod" />
|
||||
<aop:after-throwing method="afterThrowing" pointcut-ref="echoMethod" />
|
||||
<aop:after-returning method="afterReturning" pointcut-ref="echoMethod" />
|
||||
<aop:after method="after" pointcut-ref="echoMethod" />
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
Reference in New Issue
Block a user