Centralized Configuration Management Server for ExhibitFlow Microservices Architecture.
The Config Server provides centralized configuration management for all microservices in the ExhibitFlow ecosystem. It uses Spring Cloud Config Server to externalize configuration and supports dynamic configuration refresh via Kafka events.
- Centralized Configuration: Single source of truth for all microservice configurations
- Dynamic Refresh: Configuration changes can be applied without restarting services
- Git Backend: Stores configurations in Git for version control and audit trail
- Service Discovery: Registers with Eureka for service discovery
- Kafka Integration: Publishes config refresh events to notify services of changes
+----------------+
| Config Server | <--- Git/DB (central config)
+-------+--------+
|
| Publish refresh event
v
+----------------+ Kafka Topic +----------------+
| Microservice A | <------------------ | Microservice B |
+----------------+ +----------------+
- Default Port:
8888
- Registers with Eureka at
http://localhost:8761/eureka/ - Service name:
config-server
- Default URI:
https://github.com/ExhibitFlow/config-repo - Branch:
main - Search paths:
{application}directory per service
- Config Refresh Events:
config-refresh-events
POST /config/refresh/{serviceName}
Content-Type: application/json
[
"database.url",
"api.timeout"
]POST /config/refresh-allGET /config/healthGET /{application}/{profile}
GET /{application}/{profile}/{label}Example:
GET /api-gateway/default
GET /stall-service/production/mainconfig-repo/
├── api-gateway/
│ ├── application.properties
│ ├── application-dev.properties
│ └── application-prod.properties
├── identity-service/
│ ├── application.properties
│ └── application-prod.properties
├── stall-service/
│ ├── application.properties
│ └── application-prod.properties
├── reservation-service/
│ └── application.properties
└── notification-service/
└── application.properties
- Java 17+
- Maven 3.8+
- Kafka running on
localhost:9092 - Eureka Server running on
localhost:8761
# Using Maven
mvn spring-boot:run
# Using compiled JAR
mvn clean package
java -jar target/config-server-0.0.1-SNAPSHOT.jarMicroservices that want to use the Config Server should add these dependencies:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-kafka</artifactId>
</dependency>And configure in application.properties:
spring.cloud.config.uri=http://localhost:8888
spring.cloud.config.fail-fast=true
spring.cloud.config.retry.max-attempts=3
# Kafka for config refresh
spring.kafka.bootstrap-servers=localhost:9092When configuration changes are pushed to the Git repository:
- Config Server detects the changes
- Publishes a refresh event to Kafka topic
config-refresh-events - Microservices listening to this topic reload their configuration
- No service restart required
# View current environment properties
GET /actuator/env
# View configuration properties
GET /actuator/configprops
# Manually refresh configuration
POST /actuator/refresh
# Health check
GET /actuator/health