@ -124,18 +124,6 @@ public class PropertySourceAnnotationTests {
@@ -124,18 +124,6 @@ public class PropertySourceAnnotationTests {
System . clearProperty ( "path.to.properties" ) ;
}
/ * *
* Corner bug reported in SPR - 9127 .
* /
@Test
public void withNameAndMultipleResourceLocations ( ) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext ( ) ;
ctx . register ( ConfigWithNameAndMultipleResourceLocations . class ) ;
ctx . refresh ( ) ;
assertThat ( ctx . getEnvironment ( ) . containsProperty ( "from.p1" ) , is ( true ) ) ;
assertThat ( ctx . getEnvironment ( ) . containsProperty ( "from.p2" ) , is ( true ) ) ;
}
/ * *
* SPR - 10820
* /
@ -155,6 +143,24 @@ public class PropertySourceAnnotationTests {
@@ -155,6 +143,24 @@ public class PropertySourceAnnotationTests {
ctx . refresh ( ) ;
}
@Test
public void withNameAndMultipleResourceLocations ( ) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext ( ConfigWithNameAndMultipleResourceLocations . class ) ;
assertThat ( ctx . getEnvironment ( ) . containsProperty ( "from.p1" ) , is ( true ) ) ;
assertThat ( ctx . getEnvironment ( ) . containsProperty ( "from.p2" ) , is ( true ) ) ;
// p2 should 'win' as it was registered last
assertThat ( ctx . getEnvironment ( ) . getProperty ( "testbean.name" ) , equalTo ( "p2TestBean" ) ) ;
}
@Test
public void withMultipleResourceLocations ( ) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext ( ConfigWithMultipleResourceLocations . class ) ;
assertThat ( ctx . getEnvironment ( ) . containsProperty ( "from.p1" ) , is ( true ) ) ;
assertThat ( ctx . getEnvironment ( ) . containsProperty ( "from.p2" ) , is ( true ) ) ;
// p2 should 'win' as it was registered last
assertThat ( ctx . getEnvironment ( ) . getProperty ( "testbean.name" ) , equalTo ( "p2TestBean" ) ) ;
}
@Test
public void withPropertySources ( ) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext ( ConfigWithPropertySources . class ) ;