This repository contains centralized configuration files for all microservices in the Ecommerce Microservices Architecture using Spring Cloud Config.
This repository acts as the central configuration source for all microservices in your architecture. The Spring Cloud Config Server will load and serve these configuration files to each microservice during startup.
ecommerce-config-repo/
├── product-service.yml
├── order-service.yml
├── inventory-service.yml
├── payment-service.yml
├── discovery-server.yml
├── gateway-service.yml
Each file holds configuration properties like:
server.portspring.datasource(DB config)spring.application.nameeureka.client.service-url- Any custom per-service properties
spring:
cloud:
config:
server:
git:
uri: https://github.com/YOUR_USERNAME/ecommerce-config-repoReplace
YOUR_USERNAMEwith your actual GitHub username.
spring:
config:
import: optional:configserver:http://localhost:8888
application:
name: product-serviceMake sure
namematches the correct file name in this repo (e.g.,product-service.yml).
server:
port: 8081
spring:
application:
name: product-service
datasource:
url: jdbc:mysql://localhost:3306/product_db
username: root
password: password
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eurekaAdd this to the .gitignore file:
# IDEs and OS
.idea/
.vscode/
.DS_Store
# Logs
*.log
# Build
target/
- The
ecommerce-config-repois required by Spring Cloud Config Server to serve properties to each service. - Each service loads its own configuration using the
spring.application.namekey.