no

Kickstarting Your Spring Cloud Journey with the 2022 Skeleton Project

In this article, I will share a composition of a Spring Cloud 2022 skeleton project with Spring Boot 3.

1. Introduction

Spring Cloud 2022 is a long-awaited major release that builds on top of Spring Framework 6.x and Spring Boot 3.x. It needs at least Java 17 to run, which means it is fully compatible with Jakarta framework.

GIT repository is available below.

2. Spring Cloud Microservices

The following services demonstrate a basic microservice architecture.

2.1 config-service

This module depends on spring-cloud-config-server and connects with a git repo to serve the configuration settings. This is very useful if you want your configurations to be loaded from a central repository.

2.2 discovery-server

This module depends on spring-cloud-starter-netflix-eureka-server where other services can register and be looked up.

2.3 api-gateway

This module depends on spring-cloud-starter-gateway. It is the gateway for all incoming requests and makes the necessary load balance forwarding to the actual service implementation.

2.4 mail-services

This module depends on spring-cloud-starter-config to connect to the config server and spring-cloud-starter-netflix-eureka-client to register to the Eureka naming server.

It also depends on Webflux for providing a REST endpoint.

3. Running the Services

Make the folder /config-repo a git repo by going inside the folder and running the command below.

>git init

The services must be run in this order

  • config-server
  • discovery-server
  • mail-services
  • api-gateway

4. Testing the Services

mail-services

This service runs on port 8001.

The actual URL is http://localhost:8001/mails/profiles/1

api-gateway

This service runs on port 8001. It simply forwards the request to the mail-services.

The actual URL is http://localhost:8000/mails/profiles/1

5. Repository


Related

spring-microservice 6412830754469759132

Post a Comment Default Comments

item