huan95654 2019-03-08 16:06
浏览 3465

spring boot aop多个切面切一个点时,只执行了其中一个?

aop中配置了两个切面,指向同一个切点,但是只有order=1的执行了,不能两个都执行吗?

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop-4.0.xsd">
    <aop:aspectj-autoproxy />
    <bean id="TestAspect" class="com.example.demo.aspect.TestHandler"></bean>
    <bean id="TestAspect2" class="com.example.demo.aspect.TestHandler2"></bean>

    <aop:config>
        <aop:aspect id="testAccess" ref="TestAspect" order="2">
            <aop:around method="handleRestMethod1"
                        pointcut="(execution(* com.example.demo.controller..*.*(..))) and
                        (@annotation(restMethod))"/>
        </aop:aspect>

        <aop:aspect id="testAccess2" ref="TestAspect2" order="1">
            <aop:around method="handleRestMethod2"
                        pointcut="(execution(* com.example.demo.controller..*.*(..))) and
                        (@annotation(restMethod))"/>
        </aop:aspect>
    </aop:config>

</beans>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 C# datagridview 栏位进度
    • ¥15 vue3页面el-table页面数据过多
    • ¥100 vue3中融入gRPC-web
    • ¥15 kali环境运行volatility分析android内存文件,缺profile
    • ¥15 写uniapp时遇到的问题
    • ¥15 vs 2008 安装遇到问题
    • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
    • ¥15 找一个网络防御专家,外包的
    • ¥100 能不能让两张不同的图片md5值一样,(有尝)
    • ¥15 informer代码训练自己的数据集,改参数怎么改