@@ -234,6 +234,14 @@ void multipleComposedPropertySourceAnnotations() { // gh-30941
234
234
ctx .close ();
235
235
}
236
236
237
+ @ Test
238
+ void multipleResourcesFromPropertySourcePattern () { // gh-21325
239
+ ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext (ResourcePatternConfig .class );
240
+ ctx .getBean (ResourcePatternConfig .class );
241
+ assertEnvironmentContainsProperties (ctx , "from.p1" , "from.p2" , "from.p3" , "from.p4" , "from.p5" );
242
+ ctx .close ();
243
+ }
244
+
237
245
@ Test
238
246
void withNamedPropertySources () {
239
247
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (ConfigWithNamedPropertySources .class );
@@ -277,15 +285,15 @@ void orderingWithAndWithoutNameAndMultipleResourceLocations() {
277
285
}
278
286
279
287
@ Test
280
- void orderingWithAndWithoutNameAndFourResourceLocations () {
288
+ void orderingWithFourResourceLocations () {
281
289
// SPR-12198: p4 should 'win' as it was registered last
282
- AnnotationConfigApplicationContext ctxWithoutName = new AnnotationConfigApplicationContext (ConfigWithFourResourceLocations .class );
283
- assertEnvironmentProperty (ctxWithoutName , "testbean.name" , "p4TestBean" );
284
- ctxWithoutName .close ();
290
+ AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (ConfigWithFourResourceLocations .class );
291
+ assertEnvironmentProperty (ctx , "testbean.name" , "p4TestBean" );
292
+ ctx .close ();
285
293
}
286
294
287
295
@ Test
288
- void orderingDoesntReplaceExisting () throws Exception {
296
+ void orderingDoesntReplaceExisting () {
289
297
// SPR-12198: mySource should 'win' as it was registered manually
290
298
AnnotationConfigApplicationContext ctxWithoutName = new AnnotationConfigApplicationContext ();
291
299
MapPropertySource mySource = new MapPropertySource ("mine" , Map .of ("testbean.name" , "myTestBean" ));
@@ -522,6 +530,12 @@ static class ConfigWithRepeatedPropertySourceAnnotationsOnComposedAnnotation {
522
530
static class MultipleComposedAnnotationsConfig {
523
531
}
524
532
533
+
534
+ @ PropertySource ("classpath*:org/springframework/context/annotation/p?.properties" )
535
+ static class ResourcePatternConfig {
536
+ }
537
+
538
+
525
539
@ Configuration
526
540
@ PropertySources ({
527
541
@ PropertySource (name = "psName" , value = "classpath:org/springframework/context/annotation/p1.properties" ),
0 commit comments