Andrunevchyn

Andrunevchyn


November 2016
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
282930  

Categories


Issue: multiply properties configs on Spring

Andriy AndrunevchynAndriy Andrunevchyn

Spent some time to figure out why i cannot add properties on app context.
Config was pretty trivial

<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="properties" ref="configproperties" />
</bean>
 
<bean id="configproperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
    <property name="locations">
        <list>
                          <value>classpath:/properties/common.properties</value>
        </list>
    </property>
</bean>

so 2 hours lost and I figured out there is no issue with this part of config I just didn’t notice one line on top

<context:property-placeholder  location="classpath:old.properties" />

Definitely you cannot mix two approaches. The worst thing is you will not see any exception or warning just binding will not work

@Value(value = "${propname}")
private String property; //throw exception runtime

 

andriy@andrunevchyn.com

Comments 0
There are currently no comments.