I'm trying to set the value of a string in a spring bean using @Value
, when my property source is a subclass of PropertyPlaceholderConfigurer
. Anyone know how to do this ?
Old question, but still worth to be answered. You can use the expression the same way as you would with the original PropertyPlaceholderConfigurer
.
app.properties
app.value=Injected
app-context.xml
<bean id="propertyConfigurer" class="MyPropertyPlaceholderConfigurer">
<property name="location">
<value>file:app.properties</value>
</property>
</bean>
in the target bean
@Value(value="${app.value}")
private String injected;
Tested this approach using Spring 3.0.6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With