How to change application.yml file's property value in runtime of application

263 views Asked by At

I have a scenario where I have to update value of a property in runtime only. There is a restAPI endpoint which I'm calling in my springBoot Application through FeignClient. This restAPI URL gets changed frequently, hence I want a solution so that whenever this restAPI endpoint get changed, there should no need to Stop my application, build it and deploy it again. The Approach I was trying is to update restAPI endpoint in application.yml file so that I can easily use it in @FeignCLient. I tried to update property's value through actuator but it's not working. Other Suggestion are highly appreciated.

  1. Whenever I want I can update application.yml file's property so that I can use updated property in my application.
  2. I tried with actuator endpoint to update property value failed to achieve the same.
  3. Keep All other properties in application server's app.prop file only and create a application.prop file in gitHub repo store restAPI endpoint in github repo's app.prop file and import that properties in SpringBoot application.
1

There are 1 answers

2
oseghale aloysius On

You should make the endpoint a dynamic property in application.properties file and externalize it to github or any other secure and remote location that can be accessible by your application using a config server. That is create a config server application and make your application a config client. This way if the endpoint changes, update your externalized property in github ( if you are using github as remote location) without redeploying your springboot application