public void propertyPlaceholderEnvironmentProperties() throws Exception {
MockEnvironment env = new MockEnvironment().withProperty("foo", "spam");
GenericXmlApplicationContext applicationContext = new GenericXmlApplicationContext();
applicationContext.setEnvironment(env);
applicationContext.load(new ClassPathResource("contextNamespaceHandlerTests-simple.xml", getClass()));
applicationContext.refresh();
Map<String, PlaceholderConfigurerSupport> beans = applicationContext
.getBeansOfType(PlaceholderConfigurerSupport.class);
assertFalse("No PropertyPlaceholderConfigurer found", beans.isEmpty());
String s = (String) applicationContext.getBean("string");
assertEquals("No properties replaced", "spam", s);