Can I dynamically refresh properties that are used by Spring Boot's auto configuration setup?
For example, I have the following properties set (via cloud config) to auto configure a dataSource
:
spring.datasource.username=user1
spring.datasource.password=test
Now if I change the password prop on the config server, and hit the /refresh
endpoint, I can see that the updated prop is retrieved but the DataSource
is not refreshed.
I know I can manually configure the DataSource
beans and make sure they fall under a RefreshScope
, but I was hoping to find a way to mark the auto configured properties as "refreshable". I have some use cases where I'd want to refresh props used by Spring Boot for other beans besides DataSources
, and setting up some of those beans manually could be a pain.