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

Extension to support javax.interceptor #61

Closed
gissuebot opened this issue Jul 7, 2014 · 11 comments
Closed

Extension to support javax.interceptor #61

gissuebot opened this issue Jul 7, 2014 · 11 comments

Comments

@gissuebot
Copy link

From bileblog on March 14, 2007 09:17:59

Since you support aopalliance for interceptors, it might be worth adding support for
javax.interceptor for a more JSR-friendly aop API. It's very simple and only allows for AroundInvoke,
so shouldn't be that hard to check for and implement, I hope.

Original issue: http://code.google.com/p/google-guice/issues/detail?id=61

@gissuebot
Copy link
Author

From dhanji on March 14, 2007 15:22:20

I was thinking the same thing the other day--it's a very simple aop api. but wouldnt
this create a dep on the javaee api?

Or is it now part of SE?

@gissuebot
Copy link
Author

From hani@formicary.net on March 14, 2007 15:25:21

It would create a compile time dependency on that small jar, but it'd be pretty easy to code it such that if the jar
isn't found at runtime, guice works just fine.

@gissuebot
Copy link
Author

From crazyboblee on March 14, 2007 15:25:50

I wonder if we can implement this on top of the current stuff...

@gissuebot
Copy link
Author

From dhanji on March 14, 2007 15:47:28

yea you could isolate it with a switch a la Stage--and simply not run that code at
all if not explicitly requested.

Though I suppose it would open the door to requests for AspectJ et al. not sure it's
worth all that. The value-add is minimal, it's just a really neat, simple,
standardized api.

@gissuebot
Copy link
Author

From hani@formicary.net on March 14, 2007 15:49:37

Plus it means you don't have to suck in another jar, and can run using a standard EE 5 container.

@gissuebot
Copy link
Author

From limpbizkit on May 30, 2008 01:09:00

This could probably be implemented as an extension using our existing aopalliance API under the hood. An
implementation sketch:

  public class JavaxInterceptorModule() extends AbstractModule {
    public void configure() {
      // install an interceptor using a matcher that matches methods whose
      // class or method is annotated @Interceptor

      // injectMembers() on the interceptor. interceptor should define an
      // @Inject void initialize(Injector injector) method that loops over all
      // bindings, looking for classes with @Interceptor. The interceptors
      // should either be injectable, or have a no-arg constructor
    }
  }

By implementing this as an extension on-top of the existing interceptor support, we don't need to clutter the
already-complex internal Guice implementation with yet another API.

If anyone is interested in implementing this extension, I'm interested in consulting with the implementation.
I'm also eager to code-review and checkin the implementation.

Summary: Extension to support javax.interceptor

@gissuebot
Copy link
Author

From limpbizkit on May 30, 2008 09:45:02

Fantastic. Please keep us posted on your success.

@gissuebot
Copy link
Author

From limpbizkit on June 24, 2008 21:31:47

Great news! sberan has implemented much of this, and the code is great. I've attached his implementation,
plus my own modifications to his implementation.

This code supports everything except for @ExcludeDefaultInterceptors. We might never support that, since I
don't think we'll ever need default interceptors. We need to investigate whether arrays and the contextData
map should be mutable. Plus, the order that @AroundInvoke methods are invoked. This stuff isn't particularly
well-specified in the API. We also need a lot more test coverage, especially for some of the edge cases. (what
happens when injectors throw!)

But the code is there, and it's ready for use. Nice work Sam!

Binary attachments: javaxinterceptor.zip

@gissuebot
Copy link
Author

From Dieter.Moroff on November 19, 2010 06:03:28

Are there plans to integrate to code into guice 3.x? I have a modified implementation which does not required google collection.

@gissuebot
Copy link
Author

From sberlin on November 19, 2010 06:31:26

If it works fully as an extension, it's unlikely to go into core Guice.  If someone would like to host & maintain it somewhere, we can link to it from the Wiki though.

@gissuebot
Copy link
Author

From sberlin on February 19, 2011 12:28:42

Code is attached to the issue to let it be done as an extension.  No plans to pull it into Guice core.

Status: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant