0

我试图在受保护和重载的方法 doSend 上设置 JmsTemplate 类的切入点。我感兴趣的一个如下:

protected void doSend(MessageProducer producer, Message message) throws JMSException

我的要点是:

@Pointcut("execution(* org.springframework.jms.core.JmsTemplate.doSend()) && args(producer,message)")
public void doSend() {
}

@Before("doSend(producer,message)")
public void logMessage(JoinPoint joinPoint, MessageProducer producer, Message message) {
    System.out.println("logMessage() is running!");
    System.out.println("hijacked : " + joinPoint.getSignature().getName());
    System.out.println("******");
}

但我收到以下警告停止服务器:

Caused by: java.lang.IllegalArgumentException: warning no match for this type name: producer [Xlint:invalidAbsoluteTypeName]

我已经添加了依赖项:

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-aop</artifactId>
</dependency>

<dependency>
   <groupId>org.aspectj</groupId>
   <artifactId>aspectjweaver</artifactId>
</dependency>

并启用了对 @Aspect 注释的支持:

@EnableAspectJAutoProxy(proxyTargetClass = true)

4

0 回答 0