google-code-export / google-guice

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

Register additional scope and binding annotation during binding phase #214

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Relating to issue #70 it would also be nice, if one could use 3rd party
framework annotations such as javax.ejb.Stateful as scope or binding
annotations, without being able to annotate them directly with
ScopeAnnotation or BindingAnnotation.

This could be done by registering additional scope and binding annotation
during binding phase:

bindScope(SessionScoped.class, CustomScopes.SESSION);
bind(Service.class).annotatedWith(Blue.class).to(SessionImpl.class);

In the example SessionScoped.class becomes registered as a scope annotation
and Blue.class as a binding annotation, so error reporting of multiple
scope or binding annotation usage is still consistently enabled.

Any suggestions on this one?

Original issue reported on code.google.com by sven.lin...@gmail.com on 24 Jun 2008 at 10:09

GoogleCodeExporter commented 9 years ago
This still has the 'discoverability' problem. If a developer looks at an 
arbitrary piece of code, the annotations 
don't self-describe how they're used by Guice.

Original comment by limpbizkit on 24 Jun 2008 at 3:17

GoogleCodeExporter commented 9 years ago
The arguments about upside and downside of this issue will resemble the ones 
from
issue #70, I believe. I have created this issue just for completeness in case,
someone is going to going implement #70.

Original comment by sven.lin...@gmail.com on 24 Jun 2008 at 5:18

GoogleCodeExporter commented 9 years ago
JSR330 provides additional scope/annotation interfaces if the desire is to not 
use Guice's annotations.  As mentioned in comment #1, allowing more than that 
has a discoverability problem.

Original comment by sberlin on 19 Feb 2011 at 8:34