frjaeger220 / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

Enable Guice to use custom injection markers like @EJB #132

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,
big compliments for Guice, excellent tool;-) 

I have enhanced Guice to use custom annotation markers like @EJB or
@Ressource instead of only @Inject. This makes Guice very flexible - you
can use it e.g. as DI tool for a existing EJB3 application. 

Example:
Guice.createInjector(Stage.PRODUCTION,  Guice.markerToArray(EJB.class,
                Inject.class), myModule1, myModule2);

We are planing to use Guice in our open source project Ejb3Unit
(http://ejb3unit.sourceforge.net/). Guice is a excellent candidate to
replace our current creation of session beans for testing.

Please let me know if you can apply/commit the patch?
Regards Daniel

Original issue reported on code.google.com by wie...@gmail.com on 9 Jul 2007 at 1:06

Attachments:

GoogleCodeExporter commented 9 years ago
Looks like issue #70

Original comment by robbie.v...@gmail.com on 9 Jul 2007 at 7:09

GoogleCodeExporter commented 9 years ago
It's exactly the same as 70. If you apply the patch, you will see one possible
solution. Are you planing to support this feature request in general?

Regadrs Daniel

Original comment by wie...@gmail.com on 9 Jul 2007 at 8:17

GoogleCodeExporter commented 9 years ago
I'm not the one to make the final call, but it's my understanding that Guice is
intentionally not supporting arbitrary annotations, because it is less likely to
cause confusion if there is one annotation with a clear meaning.  If there is 
some
reason you can't annotate your code's injection points with @Inject, I think 
you will
need to make a clear case for it.

Original comment by bslesinsky on 9 Jul 2007 at 11:53

GoogleCodeExporter commented 9 years ago
The use case would be to use Guice as a DI tool to support EJB3 style 
annotations. 
You could write a EJB3 conform application without having a application server.

Using Guice for the Session bean layer and e.g. Hibernate for the persistence 
layer

Daniel

Original comment by wie...@gmail.com on 10 Jul 2007 at 1:15

GoogleCodeExporter commented 9 years ago
If you want to write an application that works with both EJB and Guice, it 
seems like
you could do it by using both kinds of annotations?  Each container will ignore 
the
other's annotations, and they probably have subtly different semantics anyway.

Original comment by bslesinsky on 12 Jul 2007 at 4:06

GoogleCodeExporter commented 9 years ago
This was discussed earlier about @Resource too. I think the decision was that
Provider interceptors will solve the problem elegantly by allowing you to 
define your
own semantics prior to "delivery" of the injection.

Original comment by dha...@gmail.com on 1 Sep 2007 at 12:16

GoogleCodeExporter commented 9 years ago
Duplicate of issue 70. EJB-specific features could be implemented as 
construction-interceptors (issue 203). 

Original comment by limpbizkit on 5 Jun 2008 at 7:48

GoogleCodeExporter commented 9 years ago

Original comment by limpbizkit on 9 Jun 2008 at 6:37