• 多个切面表达式


    <?xml version="1.0" encoding="utf-8"?>
    <beans default-init-method="init" default-destroy-method="destroy"
        xmlns="http://www.springframework.org/schema/beans" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xmlns:task="http://www.springframework.org/schema/task"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:mongo="http://www.springframework.org/schema/data/mongo"
        xsi:schemaLocation="http://www.springframework.org/schema/beans 
                               http://www.springframework.org/schema/beans/spring-beans.xsd 
                               http://www.springframework.org/schema/context 
                               http://www.springframework.org/schema/context/spring-context.xsd
                               http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
                               http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd 
                               http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
                            http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd">
           
        <aop:config>
              <aop:aspect ref="dynamicDataSourceAspect">
                 <aop:pointcut id="backMethod"   
                    expression="execution(public * com.yundaex..CompleteInboundNoticeBackToQimenDaoImpl.query*(..))
                     || execution(public * com.yundaex.wms..InventoryCountReportToQimenDaoImpl.query*(..))
                      || execution(public * com.yundaex.wms..OrderProcessReportToQimenDaoImpl.query*(..))
                      || execution(public * com.yundaex.wms..OutboundNoticeConfirmBackToQimenDaoImpl.query*(..))
                       || execution(public * com.yundaex.wms..ReturnOrderBackToQimenDaoImpl.query*(..))
                        || execution(public * com.yundaex.wms..StockChangeReportToQimenDaoImpl.query*(..)) "/>  
                 <aop:around method="aroundMethod"  pointcut-ref="backMethod"/>
              </aop:aspect>
        </aop:config>
              
        <mvc:annotation-driven/>     
        <task:annotation-driven/>  
        <context:component-scan base-package="com.yundaex.wms" />
        
    </beans>
    //aop成功
        public void query() {
            String sql = " select count(1) from riv_inbound_notice_h where inh_owner_no = '425-1' ";
            System.out.println("定时器1开始"+jdbcTemplate.queryForObject(sql, Integer.class));
        }
        //aop失败
        public void test() {
            query2(); 
        }
        public void query2() {
            String sql = " select count(1) from riv_inbound_notice_h where inh_owner_no = '425-1' ";
            System.out.println("定时器1开始"+jdbcTemplate.queryForObject(sql, Integer.class));
        }
  • 相关阅读:
    微服务架构最佳实践 基础设施篇
    深入理解微服务架构:银弹 or 焦油坑?
    uniapp canvasToTempFilePath
    uniapp easycom
    前端302通常不处理,通常使用链接
    linux性能监控命令dstat详解【杭州多测师_王sir】【杭州多测师】
    杭州市民卡面试题【杭州多测师】【杭州多测师_王sir】
    Java创建多线程的3种方式和Java当中的线程池【杭州多测师】【杭州多测师_王sir】
    Python笔试题:给定一个整数数组和一个目标值、找出数组中为2个俩个数、若无返回1【杭州多测师】【杭州多测师_王sir】
    GR/IR差异价格
  • 原文地址:https://www.cnblogs.com/tonggc1668/p/6842097.html
Copyright © 2020-2023  润新知