🔄
Spring Cloud Gateway Workshop
  • README
  • Introduction
    • Prerequisites
    • Requirements and Setup
    • Introduction to Spring Cloud Gateway
    • Sample Application Architecture
    • Provided Backend Microservices
  • Intro Lab
    • Reactive Streams with Spring Reactor in Action
  • Hands-On Labs
    • Lab 1: Routing - Configure & Monitor Gateway Routes
    • Lab 2: Resilience - Retry, Circuit Breaking and Rate Limiting
    • Lab 3: Security Part 1 - Authentication with JWT
    • Lab 4: Security Part 2 - Secure Communication with TLS
  • Next Steps
    • Further Gateway Features
Powered by GitBook
On this page
  • Architecture
  • Configuration
  • Project contents
  1. Introduction

Sample Application Architecture

PreviousIntroduction to Spring Cloud GatewayNextProvided Backend Microservices

Last updated 2 years ago

Architecture

As part of this workshop we will implement the following sample application architecture.

We will use the provided existing two microservices (customer and product services) to route these through the Spring Cloud Gateway.

  • Spring Cloud Gateway: This is the component we will implement and extend during several labs

  • Customer Service: A backend service providing a REST API for retrieving customers

  • Product Service: A backend service providing a REST API for retrieving products

  • Spring Authorization Server: An OAuth 2.1 & OpenID Connect 1.0 compliant authorization server that will be used to implement the cross-cutting gateway feature for user authentication with JSON web tokens (JWT)

Configuration

These microservices are configured to be reachable via the following URL addresses (Port 8080 is the default port in spring boot).

Service URLs:

Service
URL
Secure URL (TLS Lab)

Spring Authorization Server

http://localhost:9000

--

Spring Cloud Gateway

http://localhost:9090

https://localhost:8443

Customer Service (Customer API)

http://localhost:9091

--

Product Service (Products API)

http://localhost:9092

https://localhost:8444

Project contents

After importing the project into your IDE you should see a project structure like in the following picture. Here the VS Code project is shown, it may look different in other IDE's.

The main contents for this workshop consist of the following directories:

  • rate-limiter-client: In addition to the components of the sample architecture there is also a helper client provided for testing the rate limiter in lab 2. You find this tool in this directory.

  • reactive-playground: In this subdirectory you find a demo application that provides a unit test class with lots of examples on implementing reactive streams using project reactor.

  • microservices: Here you find the provided backend microservices, both implemented using Java and Spring Boot and providing a REST API. You find these in the following subdirectories:

    • customer-service

    • product-service

  • labs: In this directory you find several workshop labs. Each lab contains two subdirectories:

    • initial: This is always the starting point for each workshop lab (this way attendees can always jump in with the next lab even if somebody could not finish the previous lab).

      • api-gateway: This is the initial spring cloud gateway microservice to start the workshop lab

    • solution: This is the reference solution for this workshop (please do NOT look into this now)

      • api-gateway: This is the reference solution of the corresponding lab for the spring cloud gateway microservice

Note: Lab 4 also contains the product-service microservice as part of the initial and solution folders. This is required as part of the secure communication topic of lab 4.

So let's start with our first hands-on lab.

Info: You can find more information on building OAuth 2.0/OIDC secured microservices with spring in and in

Spring Boot Reference Documentation
Spring Security Reference Documentation
Architecture
Project Structure