Spring的PropertyPlaceholderConfigurer,在jar文件中包含属性

Bil*_*mer 4 spring properties

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

如何在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>
Run Code Online (Sandbox Code Playgroud)

ska*_*man 5

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