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

Clarify component scanning of abstract classes with @Lookup methods #34367

Closed
cselagea opened this issue Feb 4, 2025 · 1 comment
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: documentation A documentation task
Milestone

Comments

@cselagea
Copy link

cselagea commented Feb 4, 2025

According to https://docs.spring.io/spring-framework/reference/core/beans/dependencies/factory-method-injection.html,

Concrete methods are also necessary for component scanning, which requires concrete classes to pick up.

Note that you should typically declare such annotated lookup methods with a concrete stub implementation, in order for them to be compatible with Spring’s component scanning rules where abstract classes get ignored by default.

Abstract @Lookup methods are compatible with component scanning as of 4.3.6 thanks to #19118, so the documentation is incorrect/misleading.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 4, 2025
@sbrannen sbrannen self-assigned this Feb 5, 2025
@sbrannen sbrannen added type: documentation A documentation task in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 5, 2025
@sbrannen sbrannen added this to the 6.2.3 milestone Feb 5, 2025
@sbrannen sbrannen changed the title Clarify component scanning of abstract classes with @Lookup methods Clarify component scanning of abstract classes with @Lookup methods Feb 5, 2025
@sbrannen sbrannen added the for: backport-to-6.1.x Marks an issue as a candidate for backport to 6.1.x label Feb 5, 2025
@github-actions github-actions bot added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-6.1.x Marks an issue as a candidate for backport to 6.1.x labels Feb 5, 2025
sbrannen added a commit that referenced this issue Feb 5, 2025
Due to changes in gh-19118, classes that contain @⁠Lookup methods are
no longer required to be concrete classes for use with component
scanning; however, the reference documentation still states that such
classes must not be abstract.

This commit therefore removes the outdated reference documentation and
updates the corresponding Javadoc.

See gh-19118
Closes gh-34367

(cherry picked from commit 819a7c8)
@sbrannen
Copy link
Member

sbrannen commented Feb 5, 2025

Hi @cselagea,

Congratulations on submitting your first issue for the Spring Framework! 👍

And thanks for bringing this to our attention.

The documentation has been updated in 6.1.x, 6.2.x, and main. See commit 819a7c8.

Cheers

Sam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: documentation A documentation task
Projects
None yet
Development

No branches or pull requests

3 participants