简体   繁体   中英

Property file from classpath is not getting picked java spring

I am accessing property file from class path in eclipse using PropertyPlaceholderConfigurer

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">     
    <property name="location">
        <value>classpath :database.properties</value>
    </property>
</bean>

However while creating jar using maven I am excluding the property file.

I then place jar in base installation folder and property file in properties folder.

Now when I execute the jar using

java -cp ../properties/* abc.jar

it throws database.properties file cannot be found while initializing xml error.

<context:property-placeholder location="/WEB-INF/classes/*.properties" />

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">     
<property name="location">
    <value>${app.jdbc.username}</value>
    <value>${app.jdbc.password}</value>
</property>
</bean>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM