From 9bb0c45ddbd104af0ac49553774f41df18376172 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 23 Jul 2024 09:08:42 +0100 Subject: [PATCH] Add tip about using `@Name` to rename constructor bound property Closes gh-41577 --- .../src/docs/asciidoc/features/external-config.adoc | 2 ++ 1 file changed, 2 insertions(+) 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 8874b13a6e9..54bad2a7352 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 @@ -749,6 +749,8 @@ NOTE: The use of `java.util.Optional` with `@ConfigurationProperties` is not rec As such, it is not well-suited to configuration property injection. For consistency with properties of other types, if you do declare an `Optional` property and it has no value, `null` rather than an empty `Optional` will be bound. +TIP: To use a reserved keyword in the name of a property, such as `my.service.import`, use the `@Name` annotation on the constructor parameter. + [[features.external-config.typesafe-configuration-properties.enabling-annotated-types]]