I have several Aspects encoded in my application. All others work, except for the following.
Service interface
package com.enbiso.proj.estudo.system.service; ... public interface MessageService { ... Message reply(Message message); Message send(Message message); ... }
Service implementation
package com.enbiso.proj.estudo.system.service.impl; .... @Service("messageService") public class MessageServiceImpl implements MessageService { ... @Override public Message reply(Message message) { ... return this.send(message); } @Override public Message send(Message message) { ... } }
Aspect
@Aspect @Component public class NewMessageAspect { ... @AfterReturning(value = "execution(* com.enbiso.proj.estudo.system.service.impl.MessageServiceImpl.send(..))", returning = "message") public void perform(Message message){ ... } }
When I try to execute the send method, the debug point does not fall into the perform aspect.
UPDATE
I did some research and found that this does not work when the send method is called from the reply method, as shown below
@Autowire MessageService messageService; ... messageService.reply(message);
But if I call the messageService.send(message) method, it works fine. But since the response method calls the send method internally, should it not also refer to the aspect?
I have no idea what I did wrong. Please help me.
source share