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);
      }
    }
  • 相关阅读:
    结对开发----找出“水王"
    团队博客----典型用户分析
    结对开发----电梯调度(课堂练习)
    团队开发_需求分析
    站立会议02(二期)
    站立会议01(二期)
    《软件工程》课程改进意见
    站立会议07(一期)
    站立会议06(一期)
    站立会议05(一期)
  • 原文地址:https://www.cnblogs.com/huanghuanghui/p/12331523.html
Copyright © 2011-2022 走看看