首页 > 解决方案 > 切入点引用名称以开头的所有方法

问题描述

我试图在我的代码中实现一个简单的切入点表达式,这是我的 Aspect 类

@Aspect
public class PaymentAspect {
    
    @Autowired
    private OrdineService ordineService;
    
    @Pointcut("execution(* *..createPayment*(..))")  
    public void toVerifyCart() {} 
      
    @Before("toVerifyCart()")
    public void validateCart(JoinPoint jp) throws ServiceException, TokenStreamException {
    
         //Instructions...
    }
}

这是我想调用 validateCart() 方法的方法之一......

public String createPayment(@RequestData(paramaterName = "httpRequest") Long cartID,
        String currency, String appContext, 
        @RequestData(paramaterName = "httpRequest") HttpServletRequest request) throws ServiceException;

唯一的问题是我的代码根本没有调用方法......我在这里有什么问题吗?

标签: javaspringaopaspect

解决方案


尝试@Pointcut("execution(* createPayment*(..))")


推荐阅读