zoukankan      html  css  js  c++  java
  • spring方法增强切面使用

    方法执行完成,正常返回后,进入改切点

    /**
     * @author hhh
     * @date 2020/2/10 14:43
     * @Despriction 订单修改记录Cglib代理,增强订单修改后推送
     */
    @Retention(RetentionPolicy.RUNTIME)
    @Target(ElementType.METHOD)
    @Documented
    public @interface OrderChangeProxy {
    }
    @Component
    @Aspect
    @Log4j2
    public class OrderChangePointCut {
    
      private final ModifyOrderService modifyOrderService;
    
      /**
       * 构造注入
       * 保证实例唯一与实例不为null
       * @param modifyOrderService
       */
      @Autowired
      public OrderChangePointCut(ModifyOrderService modifyOrderService) {
        this.modifyOrderService = modifyOrderService;
      }
    
      @Pointcut("@annotation(com.jn.ssr.superrescue.annotation.OrderChangeProxy)")
      public void orderChange() {
      }
    
      @AfterReturning(returning = "result",pointcut="orderChange()")
      public void doBefore(JoinPoint jp,Object result) {
        Object[] args =jp.getArgs();
        OrderBasicRequestEntity orderBasicRequestEntity =(OrderBasicRequestEntity) args[0];
        log.info("订单修改信息推送切点-{}",orderBasicRequestEntity.getId());
        List<BaseUpdRecordEntity> updateList =(List<BaseUpdRecordEntity>) result;
        modifyOrderService.modifyOrderToTpr(orderBasicRequestEntity,updateList);
      }
    }
  • 相关阅读:
    数据仓库的一些理解(转)
    常见ETL工具一览,你知多少?
    dhcpv6开源软件配置
    svn
    js原型模式
    combo扩展:禁止手工改变输入框的值
    SQLite错误总结 error code 19: constraint failed
    ntp源码解读(一)
    ntp-keygen.c
    6.2.2认证
  • 原文地址:https://www.cnblogs.com/huanghuanghui/p/12331523.html
Copyright © 2011-2022 走看看