I have this in my appContext.xml
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>file:pathTo/service.properties</value>
<value>file:pathTo/configuration.properties</value>
</list>
</property>
</bean>
And I'm setting a string with
@Value("${myServiceKey}")
private String url;
That WORKS and I get the value of myServiceKey in the url.
But I want to use a default value when myServiceKey is not present, so I tried this
@Value("${myServiceKey:defaultValue}")
private String url;
and it always sets the "defaultValue" instead of the correct one "myServiceKey".
I also realized that using this:
@Value("#{systemProperties['myServiceKey']}")
private String url;
I have an exception
WARN MSF4JMessageProcessor:262 - Unmapped exception -java.lang.IllegalArgumentException: URI must not be null
Is that related? What's wrong??
I'm using spring version 4.3.9.RELEASE
Thanks in advance.