I have spring boot rest service which returns the currency list. Now, I have a requirement that this currency list should be configurable by prod support guys so that they can keep adding the currencies whenever they want.
I am from the asp.net background and I know in asp.net, web.config file is editable even on the prod and prod support guys can make the changes in that file and restart the IIS server to get the latest changes.
In spring boot if I add my currencies in a property file. Will that file editable on prod.
As far as I know Spring boot creates JAR or WAR file as package. Property files won't be editable on prod.
CodePudding user response:
Externalized Configuration Spring Boot allows you to externalize your configuration so you can work with the same application code in different environments. You can use properties files, YAML files, environment variables and command-line arguments to externalize configuration.
Latest ref link :https://docs.spring.io/spring-boot/docs/2.0.6.RELEASE/reference/html/boot-features-external-config.html
CodePudding user response:
Config files are not editable at runtime. You'd need to stop the server, and modify any properties, and restart. If files aren't editable, obviously that won't work.
If you want to be able to modify runtime configs, use a database/dynamic cache lookup.
Other solutions include Spring Cloud Config, Zookeeper, or Consul.
CodePudding user response:
Externalize config via Spring Cloud Config. This will let you update your config at runtime. And also allow you to keep a track of your config version.
Have a look at this for better understanding: Spring boot-microservices config
-From java brains