Hello there fellow programmers.
I have a SpringBoot Rest API I'm working on and I'm trying to use an Aspect that performs some actions after the execution of a method with a custom annotation.
So I have this custom annotation:
@Retention(RUNTIME)
@Target(METHOD)
public @interface PublishMQ {
String destinyName() default "";
boolean skipNull() default true;
}
And I have this aspect:
@Aspect
@Component
public class PublishMQAspect {
// ...
@After("@annotation(br.com.powertiss.utils.transaction.PublishMQ)")
public Object publishChangeToMQ(Object returnValue, PublishMQ publishMQ) throws Throwable {
// ...
I'm trying to use them in a service:
@Service
public class OperatorService {
// ...
@PublishMQ(destinyName = "queues/Opera")
public Operator salve(Operadora operator) {
// ...
But I'm getting the given exception on startup:
java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
The PublishMQ and PublishMQAspect are in a separate jar from OperatorService, but I don't believe this should be an issue.
I tried many things for several hours but couldn't understand why AspectJ is raising this exception. Can you guys help? Thanks.
@AfterReturning, since you want the returned value? - M. Prokhorov