Polish "Fix bean name by adding sample class with prefix"

See gh-34029
This commit is contained in:
Andy Wilkinson 2023-02-14 21:19:41 +00:00
parent 0a3007133b
commit 710559297e

View File

@ -770,7 +770,7 @@ include::code:MyApplication[]
When the `@ConfigurationProperties` bean is registered using configuration property scanning or through `@EnableConfigurationProperties`, the bean has a conventional name: `<prefix>-<fqn>`, where `<prefix>` is the environment key prefix specified in the `@ConfigurationProperties` annotation and `<fqn>` is the fully qualified name of the bean.
If the annotation does not provide any prefix, only the fully qualified name of the bean is used.
The bean name in the example above is `some.properties-com.example.app.SomeProperties`.
Assuming that it is in the `com.example.app` package, the bean name of the `SomeProperties` example above is `some.properties-com.example.app.SomeProperties`.
====
We recommend that `@ConfigurationProperties` only deal with the environment and, in particular, does not inject other beans from the context.