}
@Test
@Deprecated
public void testServletContextPropertyPlaceholderConfigurerWithAttributes() {
MockServletContext sc = new MockServletContext();
sc.addInitParameter("key4", "mykey4");
StaticWebApplicationContext wac = new StaticWebApplicationContext();
wac.setServletContext(sc);
MutablePropertyValues pvs = new MutablePropertyValues();
pvs.add("age", "${age}");
pvs.add("name", "name${var}${var}${");
pvs.add("spouse", new RuntimeBeanReference("${ref}"));
wac.registerSingleton("tb1", TestBean.class, pvs);
ConstructorArgumentValues cas = new ConstructorArgumentValues();
cas.addIndexedArgumentValue(1, "${age}");
cas.addGenericArgumentValue("${var}name${age}");
pvs = new MutablePropertyValues();
List<Object> friends = new ManagedList<Object>();
friends.add("na${age}me");
friends.add(new RuntimeBeanReference("${ref}"));
pvs.add("friends", friends);
Set<Object> someSet = new ManagedSet<Object>();
someSet.add("na${age}me");
someSet.add(new RuntimeBeanReference("${ref}"));
pvs.add("someSet", someSet);
Map<String, Object> someMap = new ManagedMap<String, Object>();
someMap.put("key1", new RuntimeBeanReference("${ref}"));
someMap.put("key2", "${age}name");
MutablePropertyValues innerPvs = new MutablePropertyValues();
innerPvs.add("touchy", "${os.name}");
RootBeanDefinition innerBd = new RootBeanDefinition(TestBean.class);
innerBd.setPropertyValues(innerPvs);
someMap.put("key3", innerBd);
MutablePropertyValues innerPvs2 = new MutablePropertyValues(innerPvs);
someMap.put("${key4}", new BeanDefinitionHolder(new ChildBeanDefinition("tb1", innerPvs2), "child"));
pvs.add("someMap", someMap);
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, cas, pvs);
wac.getDefaultListableBeanFactory().registerBeanDefinition("tb2", bd);
pvs = new MutablePropertyValues();
pvs.add("properties", "var=${m}var\nref=tb2\nm=my");
pvs.add("searchContextAttributes", Boolean.TRUE);
wac.registerSingleton("configurer", ServletContextPropertyPlaceholderConfigurer.class, pvs);
sc.setAttribute("age", new Integer(98));
wac.refresh();
TestBean tb1 = (TestBean) wac.getBean("tb1");
TestBean tb2 = (TestBean) wac.getBean("tb2");