Is there a way to update a Spring bean dynamically if the spring beans configuration changes?
E.g. assume that I have a spring bean with boolean property x
and the spring beans has the value true
when the application starts.
So spring creates the bean with the property x
set to true.
Is there a way so that if I changes the property to x
(while the application is running) that the property will be updated e.g. to false
?
Calling the setter for x setX()
method will do that.
But it should not be a prototype bean.
it is possible with the jrebel-spring integration. it monitors your configuration and TRIES to re-wire your beans at runtime.
Though i would not use it in production...only for playing around, testing etc
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