1.
在配置文件中加入如下配置
:
<context:property-placeholder location="classpath:db.properties"/>
2.加载配置文件applicationContext.xml
ApplicationContext cxt = new ClassPathXmlApplicationContext("applicationContext.xml");
HelloWorld helloWorld = (HelloWorld)cxt.getBean("helloWorld");
<context:property-placeholder location="classpath:db.properties"/>
2.加载配置文件applicationContext.xml
ApplicationContext cxt = new ClassPathXmlApplicationContext("applicationContext.xml");
HelloWorld helloWorld = (HelloWorld)cxt.getBean("helloWorld");