New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update ambiguous documentation about ConfigurationProperties #16166
Update ambiguous documentation about ConfigurationProperties #16166
Conversation
recommend that `@ConfigurationProperties` only deal with the environment and, in | ||
particular, does not inject other beans from the context. Having said that, the | ||
particular, does not inject other beans from the context. Keep in mind 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the 'shortcut' in MyConfiguration:
In the original issue, @behrangsa asked: What is getting shortcut if we annotate MyConfiguration with @component.
But I am reading the documentation and AcmeProperties class is the one annotated with @component and not MyConfiguration class.
Is my understanding correct - if we put the @component annotation on AcmeProperties, we don't have to use the @EnableConfigurationProperties(AcmeProperties.class) in MyConfiguration class. Let me know and I can rephrase this sentence so that it does not lead to confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@viktoriya-kutsarova Yup, you're right. You either need to use @EnableConfigurationProperties(AcmeProperties.class)
or annotate AcmeProperties
with @Component
.
* pr/16166: Polish "Update ambiguous documentation about ConfigurationProperties" Update ambiguous documentation about ConfigurationProperties
@viktoriya-kutsarova thank you very much for making your first contribution to Spring Boot. This is now merged in |
Fixes gh-15753