【问题标题】:Spring's PropertyPlaceholderConfigurer with property in a jar fileSpring 的 PropertyPlaceholderConfigurer 与 jar 文件中的属性
【发布时间】:2010-12-08 15:44:01
【问题描述】:

我有多个需要参考的属性文件。下面我可以参考类路径中的两个。

如何在 jar 文件中引用属性文件?

  <bean  id="placeholderConfig" name="placeholderConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
  <list>
    <value>classpath:config/my_test.properties</value>
    <value>classpath:config/some_other.properties</value>
  </list>
</property>

【问题讨论】:

    标签: spring properties


    【解决方案1】:

    如果 JAR 在类路径中,那么您可以像引用任何其他资源一样引用其中的属性文件。只需在 JAR 文件中指定属性文件的位置即可。

    【讨论】:

      猜你喜欢
      • 2013-08-21
      • 2012-06-06
      • 2018-07-21
      • 2011-10-04
      • 2012-03-24
      • 1970-01-01
      • 1970-01-01
      • 2012-08-26
      • 2013-06-30
      相关资源
      最近更新 更多