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 cfc5d9d4c412..5a05dea81bb0 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,15 @@ * Marks a constructor, field, setter method or config method as to be autowired * by Spring's dependency injection facilities. * - *

Only one constructor (at max) of any given bean class may carry this annotation, - * indicating the constructor to autowire when used as a Spring bean. Such a - * constructor does not have to be public. + *

Only one constructor (at max) of any given bean class may carry this + * annotation with the 'required' parameter set to {@code true}, + * indicating the constructor to autowire when used as a Spring bean. + * If multiple non-required constructors carry 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, then a default constructor (if present) will be used. + * An annotated constructor does not have to be public. * *

Fields are injected right after construction of a bean, before any config * methods are invoked. Such a config field does not have to be public.