Skip to content

Ambiguous documentation about ConfigurationProperties #15753

@behrangsa

Description

@behrangsa

This paragraph is a bit ambiguous and could benefit from some rewording:

Even if the preceding configuration creates a regular bean for AcmeProperties, we
recommend that @ConfigurationProperties only deal with the environment and, in
particular, does not inject other beans from the context. Having said that, the
@EnableConfigurationProperties annotation is also automatically applied to your
project so that any existing bean annotated with @ConfigurationProperties is
configured from the Environment. You could shortcut MyConfiguration by making sure
AcmeProperties is already a bean, as shown in the following example:

  • Why is this section started with Even if the preceding configuration creates a regular bean for AcmeProperties [...], in particular Even if? It either creates a bean or it doesn't. From memory, merely annotating a POJO with @ConfigurationProperties does not turn it into a bean. Even if it did, this paragraph should read The preceding configuration creates a regular bean for AcmeProperties
  • Then, why is it connected to the next paragraph using Having said that [...]?
  • Finally, in You could shortcut MyConfiguration [...], what are we shortcutting? In other words, what is getting shortcut if we annotate MyConfiguration with @Component? It turns the POJO into a bean, but what is getting shortcut?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions