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);
      }
    }
  • 相关阅读:
    iOS 之 内存管理
    php的异步并行扩展swoole
    如何用php实现qq登陆网站
    php分页类
    php的分页代码
    一个小的投票系统
    php如何判断两个时间戳是一天
    PHP中出现Notice: Undefined index的三种解决办法
    vmvare如何安装xp虚拟机
    windows2003安装
  • 原文地址:https://www.cnblogs.com/huanghuanghui/p/12331523.html
Copyright © 2011-2022 走看看