To share spring cloud configuration.
Create another Spring Boot project, just for config files.
Git Repo (configs)
├── user-service.yml
├── order-service.yml
├── payment-service.yml
└── gateway.yml
Dependency: spring-cloud-starter-config
Main class enable config server
@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
Setup application.yml
server:
port: 8888
spring:
cloud:
config:
server:
git:
uri: <https://github.com/your-org/spring-cloud-config-repo>