Skip to content

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

Closed
@snicoll

Description

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.

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions