1.spring配置文件

<bean id="configproperties" 
         class
="org.springframework.beans.factory.config.PropertiesFactoryBean">
          
<property name="location" value="classpath:jdbc.properties"/>
    
</bean>

 2.读取属性方法

ApplicationContext c=new ClassPathXmlApplicationContext("classpath:applicationContext-datasource.xml");
Properties p
=(Properties)c.getBean("configproperties");
System.out.println(p.getProperty(
"jdbcOrcale.driverClassName"));

 

posted on 2011-08-06 00:07  自由港  阅读(2253)  评论(0编辑  收藏  举报