I have a String that I'm autowiring as a bean. The value for the String
is set via a properties file, and is loaded at runtime. That much I can verify. Here's my XML:
<context:property-placeholder location="classpath:my-app.properties" />
<bean id="loadedProp" class="java.lang.String">
<constructor-arg>
<value>${loaded-prop}</value>
</constructor-arg>
</bean>
And in my application, I autowire in the bean:
@Component
public class Foo {
@Autowired
private String loadedProp;
}
Everything works dandy. I have multiple components that autowire in this bean. What I'm trying to do is, while the application is running, update the value of the bean to be something else, so that everywhere the bean is autowired in, it uses the most up to date value. Is it possible to do this, or do I just need to restart everytime I want to change the value?