- Notifications
You must be signed in to change notification settings - Fork139
More advanced samples of spring boot and spring cloud microservices showing usage of such tools like api Swagger2 on Zuul, integraction with MongoDB, configuration server, testing with Spring Cloud Contract or Hoverfly
piomin/sample-spring-microservices-advanced
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
In this project I'm demonstrating you the most interesting features ofSpring Cloud Project for building microservice-based architecture to discuss some additional aspects like API documentation, configuration, testing or storing data.
Currently you may find here some examples of microservices implementation using different projects from Spring Cloud. All the examples are divided into the branches and described in a separated articles on my blog. Here's a full list of available examples:
- UsingSwagger2 for building API documentation and exposing it for all the microservices on API gateway, which is in that case NetlixZuul. The example is available in the branchmaster. Detailed description can be found here:Microservices API Documentation with Swagger2
- UsingSpring Cloud Contract for consumer-driven contract testing in microservices architecture and embeddedMongo simulating database in component testing. The example is available in the branchtesting. A detailed description can be found here:Testing Java Microservices.
- UsingHoverfly library for testing APIs and for simulating communication between microservices in component testing. The tests with Hoverfly will include examples with static configuration through IP address and dynamic withEureka discovery. The example is available in the branchhoverfly. A detailed description can be found here:Testing REST API with Hoverfly.
- UsingSpring Cloud Config on the client and server side for providing distributed configuration across microservices. These example will discuss some more advanced features. A detailed description can be found here:Microservices Configuration With Spring Cloud Config.
In the most cases you need to have Maven and JDK8+. The best way to run the sample applications is with IDEs like IntelliJ IDEA or Eclipse. For the some of examples you need to runMongoDB onDocker container, so you also need to have Docker installed on your local machine.
Our sample microservices-based system consists of the following modules:
- gateway-service - a module that Spring Cloud Netflix Zuul for running Spring Boot application that acts as a proxy/gateway in our architecture.
- config-service - a module that uses Spring Cloud Config Server for running configuration server.
- discovery-service - a module that depending on the example it uses Spring Cloud Netflix Eureka.
- account-service - a module containing the first of our sample microservices that allows to perform CRUD operations on MongoDB repository of customer's accounts
- customer-service - a module containing the second of our sample microservices that allows to perform CRUD operations on MongoDB repository of customers. It communicates with account-service and product-service.
- product-service - a module containing the third of our sample microservices that allows to perform CRUD operations on MongoDB repository of products.
- transfer-service - a module containing the fourth of our sample microservices that allows to perform CRUD operations on MongoDB repository making cash transfers between customer accounts. It communicates with both account-service.
The following picture illustrates an approach to a contract and component testing in our sample architecture described above.
The whole sample architecture is visible on the picture below. Each microservice has its own database as shown on the following picture. For simplification in my articles I'm using a single database run on Docker container and multiple collections.
About
More advanced samples of spring boot and spring cloud microservices showing usage of such tools like api Swagger2 on Zuul, integraction with MongoDB, configuration server, testing with Spring Cloud Contract or Hoverfly
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.

