|
|
|
@ -28,11 +28,11 @@ import java.lang.annotation.Target; |
|
|
|
|
* {@link javax.inject.Inject} annotation, adding required-vs-optional semantics. |
|
|
|
|
* |
|
|
|
|
* <h3>Autowired Constructors</h3> |
|
|
|
|
* <p>Only one constructor of any given bean class may declare this annotation with |
|
|
|
|
* the 'required' attribute set to {@code true}, indicating <i>the</i> constructor |
|
|
|
|
* to autowire when used as a Spring bean. Furthermore, if the 'required' attribute |
|
|
|
|
* is set to {@code true}, only a single constructor may be annotated with |
|
|
|
|
* {@code @Autowired}. If multiple <i>non-required</i> constructors declare the |
|
|
|
|
* <p>Only one constructor of any given bean class may declare this annotation with the |
|
|
|
|
* {@link #required} attribute set to {@code true}, indicating <i>the</i> constructor |
|
|
|
|
* to autowire when used as a Spring bean. Furthermore, if the {@code required} |
|
|
|
|
* attribute is set to {@code true}, only a single constructor may be annotated |
|
|
|
|
* with {@code @Autowired}. If multiple <i>non-required</i> constructors declare the |
|
|
|
|
* annotation, they will be considered as candidates for autowiring. The constructor |
|
|
|
|
* with the greatest number of dependencies that can be satisfied by matching beans |
|
|
|
|
* in the Spring container will be chosen. If none of the candidates can be satisfied, |
|
|
|
@ -60,10 +60,10 @@ import java.lang.annotation.Target; |
|
|
|
|
* reference documentation for details). |
|
|
|
|
* |
|
|
|
|
* <h3>Multiple Arguments and 'required' Semantics</h3> |
|
|
|
|
* <p>In the case of a multi-arg constructor or method, the 'required' parameter is |
|
|
|
|
* applicable to all arguments. Individual parameters may be declared as Java-8 style |
|
|
|
|
* <p>In the case of a multi-arg constructor or method, the {@link #required} attribute |
|
|
|
|
* is applicable to all arguments. Individual parameters may be declared as Java-8 style |
|
|
|
|
* {@link java.util.Optional} or, as of Spring Framework 5.0, also as {@code @Nullable} |
|
|
|
|
* or a not-null parameter type in Kotlin, overriding the base required semantics. |
|
|
|
|
* or a not-null parameter type in Kotlin, overriding the base 'required' semantics. |
|
|
|
|
* |
|
|
|
|
* <h3>Autowiring Arrays, Collections, and Maps</h3> |
|
|
|
|
* <p>In case of an array, {@link java.util.Collection}, or {@link java.util.Map} |
|
|
|
|