xiaodududu / google-guice

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

Optional injection not supported in JSR-330 integration - can we make an @Optional field annotation? #671

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Optional injection not supported in JSR-330 integration - can we make an 
@Optional field annotation?  This would allow

@Inject @Optional
public MyOptionalService service;

Guice would still support previous behaviour but would treat @Optional on an 
@Inject-ed method as if it were com.google.inject.Inject(optional=true);

Original issue reported on code.google.com by cgruber@google.com on 6 Dec 2011 at 4:38

GoogleCodeExporter commented 9 years ago
I talked to the reporter. We decided it's easiest to just inject null.

Original comment by limpbizkit on 7 Dec 2011 at 5:49