Sync with 3.1.x
* 3.1.x:
Warn re Environment construction and instance vars
Disallow empty @PropertySource(value = {})
Fix @PropertySource bug with multiple values
final preparations for 3.1.1 release
added "receive-timeout" attribute to "jms:listener-container" element
This commit is contained in:
@@ -118,6 +118,25 @@ 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));
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void withEmptyResourceLocations() {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
ctx.register(ConfigWithEmptyResourceLocations.class);
|
||||
ctx.refresh();
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
@PropertySource(value="classpath:${unresolvable}/p1.properties")
|
||||
@@ -178,4 +197,21 @@ public class PropertySourceAnnotationTests {
|
||||
@PropertySource("classpath:org/springframework/context/annotation/p2.properties")
|
||||
static class P2Config {
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
@PropertySource(
|
||||
name = "psName",
|
||||
value = {
|
||||
"classpath:org/springframework/context/annotation/p1.properties",
|
||||
"classpath:org/springframework/context/annotation/p2.properties"
|
||||
})
|
||||
static class ConfigWithNameAndMultipleResourceLocations {
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
@PropertySource(value = {})
|
||||
static class ConfigWithEmptyResourceLocations {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
testbean.name=p1TestBean
|
||||
testbean.name=p1TestBean
|
||||
from.p1=p1Value
|
||||
@@ -1 +1,2 @@
|
||||
testbean.name=p2TestBean
|
||||
testbean.name=p2TestBean
|
||||
from.p2=p2Value
|
||||
Reference in New Issue
Block a user