• 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);
      }
    }
  • 相关阅读:
    WCF的一些基本知识点
    WCF服务编程基础
    Spring IoC 原理猜想(转载)
    利用httponly提升应用程序安全性(转载)
    Ajax:CustomValidator对输入的文本框进行验证
    WCF学习系列
    WCF 契约
    JavaScript:search() 方法
    HDU 1596 find the safest road
    HDU 2063 过山车
  • 原文地址:https://www.cnblogs.com/huanghuanghui/p/12331523.html
Copyright © 2020-2023  润新知