|
|
|
@ -28,15 +28,17 @@ import java.lang.annotation.Target; |
|
|
|
* {@link javax.inject.Inject} annotation, adding required-vs-optional semantics. |
|
|
|
* {@link javax.inject.Inject} annotation, adding required-vs-optional semantics. |
|
|
|
* |
|
|
|
* |
|
|
|
* <h3>Autowired Constructors</h3> |
|
|
|
* <h3>Autowired Constructors</h3> |
|
|
|
* <p>Only one constructor (at max) of any given bean class may declare this annotation |
|
|
|
* <p>Only one constructor of any given bean class may declare this annotation with |
|
|
|
* with the 'required' parameter set to {@code true}, indicating <i>the</i> constructor |
|
|
|
* the 'required' attribute set to {@code true}, indicating <i>the</i> constructor |
|
|
|
* to autowire when used as a Spring bean. If multiple <i>non-required</i> constructors |
|
|
|
* to autowire when used as a Spring bean. Furthermore, if the 'required' attribute |
|
|
|
* declare the annotation, they will be considered as candidates for autowiring. |
|
|
|
* is set to {@code true}, only a single constructor may be annotated with |
|
|
|
* The constructor with the greatest number of dependencies that can be satisfied by |
|
|
|
* {@code @Autowired}. If multiple <i>non-required</i> constructors declare the |
|
|
|
* matching beans in the Spring container will be chosen. If none of the candidates |
|
|
|
* annotation, they will be considered as candidates for autowiring. The constructor |
|
|
|
* can be satisfied, then a primary/default constructor (if present) will be used. |
|
|
|
* with the greatest number of dependencies that can be satisfied by matching beans |
|
|
|
* If a class only declares a single constructor to begin with, it will always be used, |
|
|
|
* in the Spring container will be chosen. If none of the candidates can be satisfied, |
|
|
|
* even if not annotated. An annotated constructor does not have to be public. |
|
|
|
* then a primary/default constructor (if present) will be used. If a class only |
|
|
|
|
|
|
|
* declares a single constructor to begin with, it will always be used, even if not |
|
|
|
|
|
|
|
* annotated. An annotated constructor does not have to be public. |
|
|
|
* |
|
|
|
* |
|
|
|
* <h3>Autowired Fields</h3> |
|
|
|
* <h3>Autowired Fields</h3> |
|
|
|
* <p>Fields are injected right after construction of a bean, before any config methods |
|
|
|
* <p>Fields are injected right after construction of a bean, before any config methods |
|
|
|
|