0

applicationContext.xml で次の構成を使用しました

<context:property-placeholder location="classpath:system.properties,file:/data/conf/system.properties,file:/data/conf/1033.properties" ignore-unresolvable="true" />

いくつかのプレースホルダーをロードするには:

  1. で定義されているこれらのプロパティを使用しclasspath:system.propertiesます。
  2. ファイルまたはプロパティが に存在する場合は/data/conf/system.properties、上記の代わりにそれらを使用します。
  3. ファイルまたはプロパティが に存在する場合は/data/conf/1033.properties、上記の代わりにそれらを使用してください。

/data/conf/system.propertiesとの両方が存在する場合、Spring は正常に起動しましたが、いずれかが存在しない場合/data/conf/1033.propertiesはスローされます。rg.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: ...

スプリング ロードにこれらのプロパティを伝えるが、欠落しているプロパティを無視する方法。

4

1 に答える 1

3

追加する必要がありますignore-resource-not-found="true"

<context:property-placeholder location="classpath:system.properties,file:/data/conf/system.properties,file:/data/conf/1033.properties" 
   ignore-unresolvable="true"  
   ignore-resource-not-found="true"/>
于 2016-06-21T10:46:12.017 に答える