Skip to content

When context uses component scan, parent class conditions are ignored in favor of nested class conditions. #31123

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

Closed
wants to merge 1 commit into from

Conversation

cagliostro92
Copy link

@cagliostro92 cagliostro92 commented Aug 28, 2023

The solution is really simple and non-invasive: in the context scan flow, when scan(basePackages) is invoked, we deal with resources instead of classes. Before any further evaluations, these resources need to be sorted based on how many "$" are present in the filename. When a valid candidate is excluded because of a non-matching condition, the corresponding filename is added to a list. Before registering a candidate, this list is consulted. The candidate is registered if the list doesn't contain the candidate's parent filename.

Closes #29372

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 28, 2023
@cagliostro92

This comment was marked as resolved.

@cagliostro92

This comment was marked as resolved.

@snicoll

This comment was marked as resolved.

@jhoeller
Copy link
Contributor

Closing this PR along with #29372 and #30750 since classpath scanning is meant to find such nested classes independently when they carry their own stereotype annotation.

@jhoeller jhoeller closed this Dec 29, 2023
@jhoeller jhoeller added 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 Dec 29, 2023
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parent Conditionals are ignored on component scanning
4 participants