开发者社区 问答 正文

spring aop 配置问题,高手求助:报错

先上代码,


<aop:config>
   <aop:pointcut id="profileAudit" expression="execution(* com..*ServiceImpl.*(..)) or execution(* com..*DaoImpl.*(..))" />
   <aop:aspect ref="profileAdvice" order="5">
      <aop:before pointcut-ref="profileAudit" method="beforeExecute" />
      <aop:after pointcut-ref="profileAudit" method="afterExecute" />
   </aop:aspect>
</aop:config>

这个配置可以监控所有的service、dao的请求,但是现在有两个类不希望被监控到,谁能帮个忙?



展开
收起
kun坤 2020-06-07 08:02:21 566 分享 版权
1 条回答
写回答
取消 提交回答
  • <aop:config>
       <aop:pointcutid="profileAudit"expression="execution(* com..*ServiceImpl.*(..)) or !execution(* com..*DaoImpl.xxx(..))"/>
       <aop:aspectref="profileAdvice"order="5">
          <aop:beforepointcut-ref="profileAudit"method="beforeExecute"/>
          <aop:afterpointcut-ref="profileAudit"method="afterExecute"/>
       </aop:aspect>

    </aop:config>

    ######回复 @巴拉巴拉卟 : 这样所有的DAO操作都不会在控制内了?我是想只把其中的一个DAO操作剔除,目前的做法是用目录控制,想知道在aop配置中能不能去掉######没试过, 你可以试试看.
    2020-06-07 08:02:28
    赞同 展开评论