【发布时间】:2025-12-24 04:15:06
【问题描述】:
我创建了以下调用类,当一个被拦截的方法被调用时应该被调用:
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();
}
}
还有这个资源:
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");
}
}
但我只从资源中获取日志行。
【问题讨论】:
标签: quarkus