From df15b64e8647c0ddf53a641f1a98e1adc98fa6e8 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Thu, 4 Apr 2019 18:31:04 +0200 Subject: [PATCH] Document @Autowired support on parameters Closes gh-21118 --- .../beans/factory/annotation/Autowired.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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 f19faa72cf..985b651f14 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 @@ -48,6 +48,15 @@ import java.lang.annotation.Target; * Bean property setter methods are effectively just a special case of such a general * config method. Such config methods do not have to be public. * + *

Autowired Parameters

+ *

Although {@code @Autowired} can technically be declared on individual method + * or constructor parameters since Spring Framework 5.0, most parts of the + * framework ignore such declarations. The only part of the core Spring Framework + * that actively supports autowired parameters is the JUnit Jupiter support in + * the {@code spring-test} module (see the + * TestContext framework + * 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