質問

I have tried to access class path property & user-defined path property file as below:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
            <value>Common.properties</value>
            <value>user.home:/database.properties</value>
        </list>
      </property> 
      <property name="ignoreUnresolvablePlaceholders" value="true"/>
      <property name="ignoreResourceNotFound" value="false"/>
</bean>

Here Common.properties path is working but user.home:/database.properties path is not working. It is showing the error:

org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [user.home:/database.properties] cannot be opened because it does not exist
(MSC service thread 1-6) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:87)

Am using jBoss 7 and I have changed standalone.bat to include the below path:

set JAVA_OPTS=-Duser.home=file:%JBOSS_CONFIG_DIR%/database.properties

Is this correct?? If any other way to access custom property path please let me know.

正しい解決策はありません

他のヒント

Try using placeholders to hold the System property key: ${user.home}. Also you have duplicated the database.properties in the System property and the config file.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top