Skip to content
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

Conversation

viktoriya-kutsarova
Copy link
Contributor

Fixes gh-15753

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 7, 2019
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
Copy link
Contributor Author

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.

Copy link
Contributor

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.

@mbhave mbhave added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 8, 2019
@mbhave mbhave added this to the 2.1.x milestone Mar 8, 2019
@snicoll snicoll self-assigned this Mar 12, 2019
@snicoll snicoll modified the milestones: 2.1.x, 2.1.4 Mar 12, 2019
snicoll added a commit that referenced this pull request Mar 12, 2019
* pr/16166:
  Polish "Update ambiguous documentation about ConfigurationProperties"
  Update ambiguous documentation about ConfigurationProperties
@snicoll snicoll closed this in f07de1b Mar 12, 2019
@snicoll
Copy link
Member

snicoll commented Mar 12, 2019

@viktoriya-kutsarova thank you very much for making your first contribution to Spring Boot. This is now merged in 2.1.x and master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ambiguous documentation about ConfigurationProperties
4 participants