Skip to content

Latest commit

 

History

History
79 lines (52 loc) · 1.8 KB

File metadata and controls

79 lines (52 loc) · 1.8 KB

Microservices with Spring Boot

Overview

A simple microservices architecture using Spring Boot, Spring Cloud, and Spring Data JPA.

Includes:

  • Config Server
  • Eureka Server
  • Company Service
  • Proxy/Gateway Service

Services

Config Service

  • Port: 8888
  • Provides centralized configuration for all services.
  • Example URL: http://localhost:8888/company-service/default

Eureka Server

  • Port: 8761
  • Service registry for discovery.
  • Dashboard: http://localhost:8761

Company Service

  • Port: 8082
  • JPA repository exposed via Spring Data REST.
  • Example endpoint:
GET http://localhost:8082/companies

Proxy / Gateway Service

  • Port: 8080
  • Routes requests to backend services via Spring Cloud Gateway.
  • Example endpoint through the gateway (proxying to company service):
GET http://localhost:8080/company-service/companies

How to Run

Start each service from the project root using Maven. Example commands:

# Start Config Service
mvn spring-boot:run -pl config-service

# Start Eureka Server (service registry)
mvn spring-boot:run -pl register-service

# Start Company Service
mvn spring-boot:run -pl company-service

# Start Proxy / Gateway Service
mvn spring-boot:run -pl proxy-service

Notes

  • Make sure ports 8888, 8761, 8082 and 8080 are available.
  • Start the Config Service before other services if they rely on centralized configuration.
  • Start the Eureka Server before services that register with it (or run both in parallel if using a locally cached config during development).

Troubleshooting

  • If a service fails to start, check its application logs for port conflicts or missing configuration.
  • For Spring Cloud Gateway routing issues, verify service IDs and routes in the gateway configuration.

Enjoy building with Spring Boot microservices!