문제

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