@@ -124,9 +124,14 @@ public void withResolvablePlaceholder() {
124124		System .clearProperty ("path.to.properties" );
125125	}
126126
127- 	/** 
128- 	 * SPR-10820 
129- 	 */ 
127+ 	@ Test (expected  = IllegalArgumentException .class )
128+ 	public  void  withEmptyResourceLocations () {
129+ 		AnnotationConfigApplicationContext  ctx  = new  AnnotationConfigApplicationContext ();
130+ 		ctx .register (ConfigWithEmptyResourceLocations .class );
131+ 		ctx .refresh ();
132+ 	}
133+ 
134+ 	// SPR-10820 
130135	@ Test 
131136	public  void  orderingWithAndWithoutNameAndMultipleResourceLocations () {
132137		// p2 should 'win' as it was registered last 
@@ -136,13 +141,6 @@ public void orderingWithAndWithoutNameAndMultipleResourceLocations() {
136141		assertThat (ctxWithName .getEnvironment ().getProperty ("testbean.name" ), equalTo ("p2TestBean" ));
137142	}
138143
139- 	@ Test (expected =IllegalArgumentException .class )
140- 	public  void  withEmptyResourceLocations () {
141- 		AnnotationConfigApplicationContext  ctx  = new  AnnotationConfigApplicationContext ();
142- 		ctx .register (ConfigWithEmptyResourceLocations .class );
143- 		ctx .refresh ();
144- 	}
145- 
146144	@ Test 
147145	public  void  withNameAndMultipleResourceLocations () {
148146		AnnotationConfigApplicationContext  ctx  = new  AnnotationConfigApplicationContext (ConfigWithNameAndMultipleResourceLocations .class );
@@ -170,6 +168,15 @@ public void withPropertySources() {
170168		assertThat (ctx .getEnvironment ().getProperty ("testbean.name" ), equalTo ("p2TestBean" ));
171169	}
172170
171+ 	@ Test 
172+ 	public  void  withNamedPropertySources () {
173+ 		AnnotationConfigApplicationContext  ctx  = new  AnnotationConfigApplicationContext (ConfigWithNamedPropertySources .class );
174+ 		assertThat (ctx .getEnvironment ().containsProperty ("from.p1" ), is (true ));
175+ 		assertThat (ctx .getEnvironment ().containsProperty ("from.p2" ), is (true ));
176+ 		// p2 should 'win' as it was registered last 
177+ 		assertThat (ctx .getEnvironment ().getProperty ("testbean.name" ), equalTo ("p2TestBean" ));
178+ 	}
179+ 
173180	@ Test 
174181	public  void  withMissingPropertySource () {
175182		thrown .expect (BeanDefinitionStoreException .class );
@@ -269,29 +276,38 @@ static class ConfigWithMultipleResourceLocations {
269276
270277	@ Configuration 
271278	@ PropertySources ({
272- 		@ PropertySource (name  =  "psName" ,  value = "classpath:org/springframework/context/annotation/p1.properties" ),
273- 		@ PropertySource (name  =  "psName" ,  value = " classpath:org/springframework/context/annotation/p2.properties"
279+ 		@ PropertySource ("classpath:org/springframework/context/annotation/p1.properties" ),
280+ 		@ PropertySource (" classpath:org/springframework/context/annotation/p2.properties", 
274281	})
275282	static  class  ConfigWithPropertySources  {
276283	}
277284
278285
279286	@ Configuration 
280287	@ PropertySources ({
281- 		@ PropertySource (name  = "psName" , value ="classpath:org/springframework/context/annotation/p1.properties" ),
282- 		@ PropertySource (name  = "psName" , value ="classpath:org/springframework/context/annotation/missing.properties" ),
283- 		@ PropertySource (name  = "psName" , value ="classpath:org/springframework/context/annotation/p2.properties" )
288+ 			@ PropertySource (name  = "psName" , value  = "classpath:org/springframework/context/annotation/p1.properties" ),
289+ 			@ PropertySource (name  = "psName" , value  = "classpath:org/springframework/context/annotation/p2.properties" ),
290+ 	})
291+ 	static  class  ConfigWithNamedPropertySources  {
292+ 	}
293+ 
294+ 
295+ 	@ Configuration 
296+ 	@ PropertySources ({
297+ 		@ PropertySource (name  = "psName" , value  = "classpath:org/springframework/context/annotation/p1.properties" ),
298+ 		@ PropertySource (name  = "psName" , value  = "classpath:org/springframework/context/annotation/missing.properties" ),
299+ 		@ PropertySource (name  = "psName" , value  = "classpath:org/springframework/context/annotation/p2.properties" )
284300	})
285301	static  class  ConfigWithMissingPropertySource  {
286302	}
287303
288304
289305	@ Configuration 
290306	@ PropertySources ({
291- 		@ PropertySource (name  = "psName" , value = "classpath:org/springframework/context/annotation/p1.properties" ),
292- 		@ PropertySource (name  = "psName" , value = "classpath:org/springframework/context/annotation/missing.properties" , ignoreResourceNotFound =true ),
293- 		@ PropertySource (name  = "psName" , value = "classpath:${myPath}/missing.properties" , ignoreResourceNotFound =true ),
294- 		@ PropertySource (name  = "psName" , value = "classpath:org/springframework/context/annotation/p2.properties" )
307+ 		@ PropertySource (name  = "psName" , value  =  "classpath:org/springframework/context/annotation/p1.properties" ),
308+ 		@ PropertySource (name  = "psName" , value  =  "classpath:org/springframework/context/annotation/missing.properties" , ignoreResourceNotFound =true ),
309+ 		@ PropertySource (name  = "psName" , value  =  "classpath:${myPath}/missing.properties" , ignoreResourceNotFound =true ),
310+ 		@ PropertySource (name  = "psName" , value  =  "classpath:org/springframework/context/annotation/p2.properties" )
295311	})
296312	static  class  ConfigWithIgnoredPropertySource  {
297313	}
0 commit comments