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

Conditions to determine if @ComponentScan should be applied can be chosen from the wrong class #27077

Closed
snicoll opened this issue Jun 18, 2021 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented Jun 18, 2021

Here is an example that demonstrates the problem: https://github.com/snicoll-scratches/demo-condition-parent

ConfigurationClassParser does the following when it determines if a @ComponentScan should be applied:

!this.conditionEvaluator.shouldSkip(sourceClass.getMetadata(), ConfigurationPhase.REGISTER_BEAN)) {

It is processed on the sourceClass rather than the configuration class being built. The former can be a parent in the hierarchy. In such a case, the conditions in the parent are going to be considered (and the conditions of the configuration class will be ignored).

I am wondering how useful this condition is though. Considering that we should ignore the conditions on the parent, the conditions on the configuration class could have been evaluated prior to run @ComponentScan.

At some point in the history of the project 620c16f was reverted to not process conditions on parent classes.

@snicoll snicoll changed the title Conditions to determine if @CompoentScan should be applied can be chosen from the wrong class Conditions to determine if @ComponentScan should be applied can be chosen from the wrong class Jun 18, 2021
@snicoll snicoll added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 18, 2021
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Nov 11, 2021
@jhoeller jhoeller self-assigned this Dec 29, 2023
@jhoeller jhoeller added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 29, 2023
@jhoeller jhoeller added this to the 6.2.x milestone Dec 29, 2023
@jhoeller jhoeller modified the milestones: 6.2.x, 6.2.0-M1 Jan 12, 2024
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) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants