Status: New
Owner: ----

New issue 558 by mingfai.ma: Support optional in JSR 330
http://code.google.com/p/google-guice/issues/detail?id=558

JSR330 doesn't support optional like @com.google.inject.Inject(optional=true). I suggest Guice should provide an annotation to allow optional/nullable injection e.g.
 @javax.inject.Inject @com.google.inject.Optional MyBean myBean;
 @javax.inject.Inject @javax.annotation.Nullable MyBean myBean;
that would work as same as @com.google.inject.Inject(optional=true)

I suppose we actually can use the old @com.google.inject.Inject(optional=true) like in the past, but it seems to be a bad idea to mix the two sets of annotations. If possible, i would prefer to use @javax.inject.* in most cases, and use Guice's extension for any feature that JSR330 doesn't support.

what do you think?

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to google-guice-...@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en.

Reply via email to