Skip to content

Commit 9bb0c45

Browse files
committed
Add tip about using @Name to rename constructor bound property
Closes gh-41577
1 parent 61dc82d commit 9bb0c45

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/external-config.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,8 @@ NOTE: The use of `java.util.Optional` with `@ConfigurationProperties` is not rec
749749
As such, it is not well-suited to configuration property injection.
750750
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.
751751

752+
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.
753+
752754

753755

754756
[[features.external-config.typesafe-configuration-properties.enabling-annotated-types]]

0 commit comments

Comments
 (0)