Spring beans with database properties which are also reload-able
My question is basically is a followup question to this one, I need Spring to inject properties to bean which are loaded from DB (this is answered in the above question) another like to be able to reload these properties. So when I change property value in the DB:
- It'll be 开发者_如何学运维reloaded automatically
- I can ask Spring to reload (re-inject) new values
How can this be done?
Thanks
Spring does not contain any built-in logic which would continuously watch your database and invoke some method when data changes (which is what you have described).
You would need to implement some logic yourself to continually poll the database, detect changes, and then re-populate the beans.
精彩评论