Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I have more than one aspect for a method and if yes how to ensure order of them with Guice AOP #1659

Open
sohansoni opened this issue Dec 8, 2022 · 0 comments

Comments

@sohansoni
Copy link

I have single method say "updateTransaction". Now I have two aspects , logging and authorization on this method.

Authorization aspect checks whether logged in user is authorized to update the transaction and logging aspect logs the parameters.
I can

Module Code:

   AuthorizationImpl authorization = new AuthorizationImpl();
    this.requestInjection(authorization);
    bindInterceptor(Matchers.any(), Matchers.annotatedWith(Authorized.class), authorization);

    final Logger logger=  new Logger();
    this.requestInjection(logger);
    this.bindInterceptor(Matchers.any(), Matchers.annotatedWith(Logger.class),   logger); 

Method :

   @Authorized
   @Logger
   public boolean updateTransaction(...)

Questions:

  1. It should invoke updateTransaction method only once, even though I have two interceptors, both are calling invocation.proceed
  2. If the authorization aspect does not allow updateTransaction to be called, then even logger aspect should not call it via proceed.
  3. How to ensure the order of those two aspects ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant