Home > front end >  Is there an @After advice Spring equivalent in Quarkus?
Is there an @After advice Spring equivalent in Quarkus?

Time:12-14

In a Quarkus application, I want to fire events with the results of a method, and we think the equivalent of an @After advice in Spring, which:

"runs after the target method is finished, including when the target method results in exception. This advice is similar to the finally block in Java that it always executes irrespective of the outcome."

But I cannot find the equivalent on Quarkus, I can only use Interceptors/Decorators, which intercepts/modifies the payload on method entry.

Is there anything equivalent, or how would you suggest to do it?

CodePudding user response:

An interceptor can still be used:

@AroundInvoke
Object intercept(InvocationContext context) throws Exception {
    Object result = context.proceed();
    // do stuff; possibly update or replace result
    return result;
}
  • Related