You can achieve this using the spring cloud components Spring Cloud Config Server and Spring Cloud Config Client .
1. spring cloud server
The server provides an HTTP resource API for external configuration (name-value pairs or equivalent YAML content). The server is easily integrated into the spring boot application using the @EnableConfigServer annotation. So, this application is a configuration server:
//ConfigServer.java @SpringBootApplication @EnableConfigServer public class ConfigServer { public static void main(String[] args) { SpringApplication.run(ConfigServer.class, args); } }
2. spring Cloud Config client
A spring A boot application can immediately use the spring configuration server (or other external property sources provided by the application developer) and will also receive additional useful functions related to environment change events.
Then on the client side of the configuration, you can quickly configure fail by setting the boot configuration property spring.cloud.config.failFast=true
Spring cloud documentation Client configuration not working
source share