From b774147db4cb281620880f7553ea3f09e94e9314 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Thu, 18 Jul 2019 12:07:39 +0200 Subject: [PATCH] Polish Javadoc for @Autowired See gh-23263 --- .../beans/factory/annotation/Autowired.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Autowired.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Autowired.java index d400f455b4..36e9174466 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Autowired.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Autowired.java @@ -28,11 +28,11 @@ import java.lang.annotation.Target; * {@link javax.inject.Inject} annotation, adding required-vs-optional semantics. * *

Autowired Constructors

- *

Only one constructor of any given bean class may declare this annotation with - * the 'required' attribute set to {@code true}, indicating the 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 non-required constructors declare the + *

Only one constructor of any given bean class may declare this annotation with the + * {@link #required} attribute set to {@code true}, indicating the 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 non-required 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). * *

Multiple Arguments and 'required' Semantics

- *

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 + *

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. * *

Autowiring Arrays, Collections, and Maps

*

In case of an array, {@link java.util.Collection}, or {@link java.util.Map}