大佬教程收集整理的这篇文章主要介绍了java – Spring:在没有Singelton Beans的情况下以编程方式使用PropertyPlaceHolderConfigurer,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我知道PropertyPlaceHolderConfigurer的以下实现是可能的:
public class SpringStart {
public static void main(String[] args) throws Exception {
PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
Properties properties = new Properties();
properties.setProperty("first.prop","first value");
properties.setProperty("second.prop","second value");
configurer.setProperties(properties);
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext();
context.addbeanfactoryPostProcessor(configurer);
context.setConfigLOCATIOn("spring-config.xml");
context.refresh();
TESTClass TESTClass = (TESTClass)context.getBean("TESTBean");
System.out.println(TESTClass.getFirst());
System.out.println(TESTClass.getSecond());
}}
在配置文件中有这个:
http://www.springframework.org/scheR_968_11845@a/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd“>
但是,这使我看到对TESTBean所做的更改将显示在所有测试bean上.
如何以这样的方式使用propertyPlaceHolderCongfigurer,我可以将它应用于bean的各个实例,并且可以访问这些实例中的每一个?
我希望这个问题有道理.任何帮助将非常感激.
以上是大佬教程为你收集整理的java – Spring:在没有Singelton Beans的情况下以编程方式使用PropertyPlaceHolderConfigurer全部内容,希望文章能够帮你解决java – Spring:在没有Singelton Beans的情况下以编程方式使用PropertyPlaceHolderConfigurer所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。