@Target(value={java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.FIELD})
@Retention(value=RUNTIME)
@Documented
public @interface Inject
Inject
,
but since JSR-330 does not support optional injection, it was extended with "optional" attribute inspired
by Google-Guice.
Original JSR-330 annotation can be also used depending whether you need to do optional or required injection.
Modifier and Type | Optional Element and Description |
---|---|
boolean |
optional
If true, injection is optional, else exception is thrown in case
injected object is not found.
|