PropertyPlaceholderConfigurer supports "${myKey:myDefaultValue}" defaulting syntax

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1994 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller
2009-09-24 22:34:02 +00:00
parent afe3442b55
commit 7d68ca8992
6 changed files with 103 additions and 42 deletions
@@ -662,6 +662,19 @@ public final class PropertyResourceConfigurerTests {
assertEquals("mytest", tb.getTouchy());
}
@Test
public void testPropertyPlaceholderConfigurerWithInlineDefault() {
factory.registerBeanDefinition("tb",
genericBeanDefinition(TestBean.class)
.addPropertyValue("touchy", "${test:mytest}").getBeanDefinition());
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
ppc.postProcessBeanFactory(factory);
TestBean tb = (TestBean) factory.getBean("tb");
assertEquals("mytest", tb.getTouchy());
}
@Test
public void testPropertyPlaceholderConfigurerWithAliases() {
factory.registerBeanDefinition("tb",