Весенний аспект, нарезка над защищенным перегруженным методом - PullRequest
0 голосов
/ 16 апреля 2020

Я пытаюсь установить срез точки на классе JmsTemplate с помощью метода doSend, который защищен и перегружен. Вот что меня интересует:

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)

...