Improve exception message to include affected configuration class

Closes gh-32998
This commit is contained in:
Stéphane Nicoll
2024-06-11 14:23:54 +02:00
parent a6fb7e99a0
commit 89e894205a
2 changed files with 9 additions and 3 deletions

View File

@@ -323,7 +323,8 @@ class ConfigurationClassParser {
List<Condition> registerBeanConditions = collectRegisterBeanConditions(configClass);
if (!registerBeanConditions.isEmpty()) {
throw new ApplicationContextException(
"Component scan could not be used with conditions in REGISTER_BEAN phase: " + registerBeanConditions);
"Component scan for configuration class [%s] could not be used with conditions in REGISTER_BEAN phase: %s"
.formatted(configClass.getMetadata().getClassName(), registerBeanConditions));
}
for (AnnotationAttributes componentScan : componentScans) {
// The config class is annotated with @ComponentScan -> perform the scan immediately