Configuration Server
Centralized Configuration
10-15 min
Configuration Server with Spring Cloud Config
In this tutorial, we will explore how to set up a centralized configuration server with Spring Cloud Config. We will see how to manage configurations in a centralized and secure way.
Server Configuration
Dependencies
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
Basic Configuration
server:
port: 8888
spring:
application:
name: config-server
cloud:
config:
server:
git:
uri: https://github.com/your-org/config-repo
default-label: main
search-paths:
- config/*/default
- config/*/prod
clone-on-start: true
Main Class
@SpringBootApplication
@EnableConfigServer
@EnableDiscoveryClient
public class ConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
Comments
Comments are powered by GitHub Discussions
Sign in with GitHub to join the discussion