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

Reference documentation for @Autowired's required attribute is misleading #23428

Closed
aCodeRancher opened this issue Aug 7, 2019 · 2 comments
Closed
Assignees
Labels
type: documentation A documentation task
Milestone

Comments

@aCodeRancher
Copy link

aCodeRancher commented Aug 7, 2019

The Spring Framework 5 reference documentation for @Autowired states:

The required attribute of @Autowired is recommended over the @Required annotation on setter methods. The required attribute indicates that the property is not required for autowiring purposes. The property is ignored if it cannot be autowired.

I think it should be "required=false indicates that the property is not required...".

Please update it if you think I am correct.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 7, 2019
@sbrannen
Copy link
Member

sbrannen commented Aug 7, 2019

Thanks for pointing that out.

The wording is indeed misleading, so we'll improve it for Spring Framework 5.2.

@sbrannen sbrannen added type: documentation A documentation task and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 7, 2019
@sbrannen sbrannen added this to the 5.2 RC2 milestone Aug 7, 2019
@sbrannen sbrannen self-assigned this Aug 7, 2019
@sbrannen sbrannen changed the title Spring 5 document section 1.9.2 Reference documentation for @Autowired's required attribute is misleading Aug 7, 2019
@sbrannen
Copy link
Member

sbrannen commented Aug 9, 2019

This has been addressed in e4fec93.

The wording of that particular sentence now reads as follows.

Setting the required attribute to false indicates that the property is not required for autowiring purposes, ...

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

No branches or pull requests

3 participants