Skip to content

Microservices sample with Spring Boot, Spring Cloud, FeignClient and Zipkin

License

Notifications You must be signed in to change notification settings

yildizmy/employee-management

Repository files navigation

employee-management

Sample Microservices with Spring Boot 3, Spring Cloud, FeignClient and Zipkin

Note

To provide a clearer focus on the microservices architecture in this application, some features, such as database, services and validation have been omitted and in-memory data is used.


Description

This project is created to demonstrate useful features of Spring Cloud Project for building microservice-based architecture. By default, Spring Cloud Config Server stores the configuration data inside the Git repository. We will change that behavior by activating the native mode. In this mode, Spring Cloud Config Server reads property sources from the classpath.


Architecture

This microservices-based system consists of the following modules:

  • gateway-service : acts as a proxy/gateway in our architecture
  • config-service : uses Spring Cloud Config Server for running configuration server in the native mode
  • discovery-service : uses Spring Cloud Netflix Eureka as an embedded discovery server
  • employee-service : sample microservice that allows to perform CRUD operation on in-memory repository of employees
  • department-service : sample microservice that allows to perform CRUD operation on in-memory repository of departments and communicates with employee-service.
  • organization-service : sample microservice that allows to perform CRUD operation on in-memory repository of organizations and communicates with both employee-service and department-service.

Getting Started

The following apps should be installed before running the application:

  • A command line app
  • Docker Desktop

Tip

For more information regarding the system requirements, etc. refer to the following pages:
Install on Mac
Install on Windows
Install on Linux


Running the application

In order to run the application on local, follow these steps:

  1. Run Docker desktop.

  1. Open command prompt window and clone the project from GitHub using the following command:
git clone https://github.com/yildizmy/employee-management.git

  1. Run Zipkin container with the following command:
docker run -d --name zipkin -p 9411:9411 openzipkin/zipkin

  1. Open the project using IntelliJ IDEA. Then select Java 21 version via File > Project Structure > Project > SDK menu and run the services in the following order:

Important

If "Lombok requires enabled annotation processing" dialog appears at this stage, click "Enable annotation processing" button.

  • config-service
  • discovery-service
  • gateway-service
  • the other services (employee-service, department-service, organization-service)

Testing the application

In order to test the application by sending request, see details on How to test? section.


Dependencies

  • Spring Boot
  • Spring Cloud
  • Spring Cloud Netflix - Eureka
  • Spring Cloud Config
  • Spring Cloud OpenFeign
  • Docker
  • Zipkin

Documentation

Spring Boot
Spring Cloud
Spring Cloud Netflix - Eureka
Spring Cloud Config
Spring Cloud OpenFeign
Docker
Zipkin


Version History

  • v0.0.1 Initial Release