【问题标题】:Load a properties file into a java.util.Properties?将属性文件加载到 java.util.Properties?
【发布时间】:2012-02-02 20:52:27
【问题描述】:

我需要将java.utils.Properties 实例注入我的一个bean。是否有一个 Spring 类会加载属性文件并将其转换为 java.utils.Properties 实例,准备好注入?

【问题讨论】:

    标签: java spring properties


    【解决方案1】:

    是的,使用<util:properties>(请参阅documentation)。

    例子:

    <!-- creates a java.util.Properties instance with values loaded from the supplied location -->
    <util:properties id="jdbcConfiguration" location="classpath:com/foo/jdbc-production.properties"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多