Skip to content

Exception that prevents component scan with REGISTER_BEAN conditions should provide the affected configuration class #32998

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
snicoll opened this issue Jun 11, 2024 · 2 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 11, 2024

Follow-up of #23206. As seen in #32996, the exception that we throw does not indicate the root cause of the problem:

Caused by: org.springframework.context.ApplicationContextException: Component scan could not be used with conditions in REGISTER_BEAN phase: [org.springframework.boot.autoconfigure.condition.OnBeanCondition@629ae7e]
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:325)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:267)
        at org.springframework.context.annotation.ConfigurationClassParser.processMemberClasses(ConfigurationClassParser.java:409)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:294)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:267)
        at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:599)
        ... 18 common frames omitted

First of all, relying on proper toString for the condition is probably the wrong call. And we just don't log the configuration class on which the wrong component scan directive can be found.

@snicoll snicoll added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) labels Jun 11, 2024
@snicoll snicoll added this to the 6.2.x milestone Jun 11, 2024
@snicoll snicoll self-assigned this Jun 11, 2024
@snicoll snicoll modified the milestones: 6.2.x, 6.2.0-M4 Jun 11, 2024
@Surendrakumare

This comment has been minimized.

@snicoll

This comment has been minimized.

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

2 participants