The full article of this repository can be found here!!
This repository contains an example of how to design and implement production-ready microservices using Spring Boot and Spring Cloud (Netflix OSS). It also applies some of the best practices for design and implementation of REST APIs like HATEOAS, DTOs, AOP and Swagger annotations for later documentation.
For enhanced security, OAuth2 authentication is added via JWT tokens stored in our MySQL (or any database of your preference) to avoid unwanted access and making sure revoked tokens are indeed... revoked.
Every submodule of this repository has a more detailed README which should help you understanding the concepts applied and how to access each service.
Before you run your application, make sure to configure your JDBC Connection. This sample features DDL and DML Scripts for MySQL that will be used across all projects of this article. Have your MySQL installation or container up & running or else you'll end up getting a few errors.
$ mvn clean install -DskipTests
$ mvn spring-boot:run
Since Zuul works as the Edge server, requests for Auth Server (9999) and API Server (9091) should all be made through port 9092. In a production environment Zuul would be in a DMZ exposed to the internet with SSL whilst our microservices would be inaccessible to the outside world.
Note: This example is using Spring Boot version 2.0.1.RELEASE and Spring Cloud version Finchley.RC1.
- Add docker-compose for creating a Stack on Rancher.
- Add a Feign client for demonstrating how to invoke REST Services besides REST Template.