Java 基于AOP的截获重载方法

Java 基于AOP的截获重载方法,java,spring,aspectj,spring-aop,Java,Spring,Aspectj,Spring Aop,我的服务有几个重载方法,例如: MyService.execute(Long id); MyService.execute(Collection collection); 我只需要通过AOP拦截“MyService.execute(Long id)”的执行,如: @Aspect @Component public class AopInterseptor{ @After("execution(* my.Service.MyService.execute(..))") publi

我的服务有几个重载方法,例如:

MyService.execute(Long id); 
MyService.execute(Collection collection);
我只需要通过AOP拦截“MyService.execute(Long id)”的执行,如:

@Aspect 
@Component
public class AopInterseptor{

  @After("execution(* my.Service.MyService.execute(..))") 
  public void intercept(JoinPoint joinPoint) throws Exception { 
    // Do stuff 
  } 
}
可以这样做吗?

关于:

@Aspect 
@Component 
public class AopInterseptor{

  @After("execution(* my.Service.MyService.execute(Long))") 
  public void intercept(JoinPoint joinPoint) throws Exception 
  {  
    // Do stuff 
  }

}
仅当方法调用中仅存在一个类型为Long的参数时,此Poincut指示符才匹配