Reputation: 1240
Is there the notion of an @RequestScope post-refresh hook?
Use Case: We need to push config changes. Currently, this is manual and fires as a part of the app restart. However, if we can trigger a /bus/refresh, once the Environment gets refreshed, not destroy the bean (an @Service in this case), yet fire some config changes once the new environment value gets updated? Is something like this possible?
Upvotes: 4
Views: 3660
Reputation: 1240
The solution I used was to make my @Service implement ApplicationListener and override onApplicationEvent(RefreshRemoteApplicationEvent event). This is already performed in RefreshListener, but my implementation was able to inspect the changed keys and react according to the rules the client setup for the specific key changes.
Upvotes: 5