Hi,
I try to use the PropertyPlaceholderConfigurer.postProcessBeanFacto ry() method, but it doesn't seems to work with the properties object setProperties().
In my log nothing appear....Code:PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); AbstractApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); ResourceLoader resourceLoader = new DefaultResourceLoader(); Resource resource = resourceLoader.getResource("classpath:default.properties"); Properties properties = new Properties(); prop.load(resource.getInputStream()); configurer.setProperties(properties); configurer.postProcessBeanFactory(context.getBeanFactory());
But if i use the setLocation() it works
Code:PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); AbstractApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); ResourceLoader resourceLoader = new DefaultResourceLoader(); Resource resource = resourceLoader.getResource("classpath:default.properties"); configurer.setLocation(resource); configurer.postProcessBeanFactory(context.getBeanFactory());Somebody have noticed that before - It is a bug ?18:19:40,129 INFO PropertyPlaceholderConfigurer:174 - Loading properties file from class path resource [default.properties]
I use spring 2.5
I really need an applicationContext class for the shutdownHook(), i cannot use the XmlBeanFactory (i use the properties object and it works).
if i use the XMLBeanFactory with setProperties() it's working :
Code:PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); factory = new XmlBeanFactory(new ClassPathResource(applicationContextFile)); ResourceLoader resourceLoader = new DefaultResourceLoader(); Resource resource = resourceLoader.getResource("classpath:default.properties"); Properties properties = new Properties(); prop.load(resource.getInputStream()); configurer.setProperties(properties); configurer.postProcessBeanFactory(factory);


Reply With Quote