From f5f02d6df192f01f31d1d72250bb1f41cf30f1df Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 20 May 2024 18:54:45 -0700 Subject: [PATCH] Document that a private constructor opts-out of constructor binding Closes gh-34820 --- .../src/docs/asciidoc/features/external-config.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/external-config.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/external-config.adoc index a45717e7f44..f28b232dca3 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/external-config.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/external-config.adoc @@ -725,7 +725,7 @@ include::code:MyProperties[] In this setup, the presence of a single parameterized constructor implies that constructor binding should be used. This means that the binder will find a constructor with the parameters that you wish to have bound. If your class has multiple constructors, the `@ConstructorBinding` annotation can be used to specify which constructor to use for constructor binding. -To opt out of constructor binding for a class with a single parameterized constructor, the constructor must be annotated with `@Autowired`. +To opt out of constructor binding for a class with a single parameterized constructor, the constructor must be annotated with `@Autowired` or made `private`. Constructor binding can be used with records. Unless your record has multiple constructors, there is no need to use `@ConstructorBinding`.