Test for property placeholder with defaults
Test property placeholder with multiple locations and default values. Issue: SPR-10619
This commit is contained in:
parent
ae74a2158a
commit
d7ec20a286
|
|
@ -265,4 +265,23 @@ public class PropertySourcesPlaceholderConfigurerTests {
|
||||||
thrown.expect(IllegalStateException.class);
|
thrown.expect(IllegalStateException.class);
|
||||||
ppc.getAppliedPropertySources();
|
ppc.getAppliedPropertySources();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void multipleLocationsWithDefaultResolvedValue() throws Exception {
|
||||||
|
// SPR-10619
|
||||||
|
PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
|
||||||
|
ClassPathResource doesNotHave = new ClassPathResource("test.properties", getClass());
|
||||||
|
ClassPathResource setToTrue = new ClassPathResource("placeholder.properties", getClass());
|
||||||
|
ppc.setLocations(new Resource[] { doesNotHave, setToTrue });
|
||||||
|
ppc.setIgnoreResourceNotFound(true);
|
||||||
|
ppc.setIgnoreUnresolvablePlaceholders(true);
|
||||||
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||||
|
bf.registerBeanDefinition("testBean",
|
||||||
|
genericBeanDefinition(TestBean.class)
|
||||||
|
.addPropertyValue("jedi", "${jedi:false}")
|
||||||
|
.getBeanDefinition());
|
||||||
|
ppc.postProcessBeanFactory(bf);
|
||||||
|
assertThat(bf.getBean(TestBean.class).isJedi(), equalTo(true));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
targetName=wrappedAssemblerOne
|
targetName=wrappedAssemblerOne
|
||||||
logicName=logicTwo
|
logicName=logicTwo
|
||||||
realLogicName=realLogic
|
realLogicName=realLogic
|
||||||
|
jedi=true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue