AroundInvoke not called with Quarkus

Viewed 1101

I created the following invoking class, which should be invoked, when an intercepted method is called:

import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;

@Interceptor
class TestAspect {

    @AroundInvoke
    public Object log(InvocationContext context) throws Exception {
        System.out.println("AroundInvoke method called");
        return context.proceed();
    }
}

and this resource:

import javax.interceptor.Interceptors;
import javax.ws.rs.GET;
import javax.ws.rs.Path;

@Path("/test")
@Interceptors(TestAspect.class)
public class TestResource {

    @GET
    @Path("/")
    public String test() {
        System.out.println("Resource method called");
        return new String("test");
    }
}

But I only get the log line from the resouce.

2 Answers

You need to activate your interceptor either by defining it in beans.xml or adding @Priority(number) on your interceptor.

Related