20
20
21
21
import org .springframework .beans .factory .BeanDefinitionStoreException ;
22
22
import org .springframework .context .ApplicationContextException ;
23
+ import org .springframework .context .annotation .Gh23206Tests .ConditionalConfiguration .NestedConfiguration ;
23
24
import org .springframework .context .annotation .componentscan .simple .SimpleComponent ;
24
25
import org .springframework .core .type .AnnotatedTypeMetadata ;
25
26
@@ -39,7 +40,9 @@ void componentScanShouldFailWithRegisterBeanCondition() {
39
40
assertThatExceptionOfType (BeanDefinitionStoreException .class ).isThrownBy (context ::refresh )
40
41
.withMessageContaining (ConditionalComponentScanConfiguration .class .getName ())
41
42
.havingCause ().isInstanceOf (ApplicationContextException .class )
42
- .withMessageContaining ("Component scan could not be used with conditions in REGISTER_BEAN phase" );
43
+ .withMessageStartingWith ("Component scan for configuration class [" )
44
+ .withMessageContaining (ConditionalComponentScanConfiguration .class .getName ())
45
+ .withMessageContaining ("could not be used with conditions in REGISTER_BEAN phase" );
43
46
}
44
47
45
48
@ Test
@@ -49,7 +52,9 @@ void componentScanShouldFailWithRegisterBeanConditionOnClasThatImportedIt() {
49
52
assertThatExceptionOfType (BeanDefinitionStoreException .class ).isThrownBy (context ::refresh )
50
53
.withMessageContaining (ConditionalConfiguration .class .getName ())
51
54
.havingCause ().isInstanceOf (ApplicationContextException .class )
52
- .withMessageContaining ("Component scan could not be used with conditions in REGISTER_BEAN phase" );
55
+ .withMessageStartingWith ("Component scan for configuration class [" )
56
+ .withMessageContaining (NestedConfiguration .class .getName ())
57
+ .withMessageContaining ("could not be used with conditions in REGISTER_BEAN phase" );
53
58
}
54
59
55
60
0 commit comments