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

This commit is contained in:
Juergen Hoeller
2009-09-24 22:34:02 +00:00
parent 8eca898d44
commit 0f43d6c592
6 changed files with 103 additions and 42 deletions

View File

@@ -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",