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"));

 

相关文章:

  • 2022-12-23
  • 2022-02-04
  • 2021-12-12
  • 2021-07-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-02
  • 2021-12-19
  • 2018-10-11
  • 2022-12-23
  • 2021-09-29
  • 2021-07-19
相关资源
相似解决方案