Giter Site home page Giter Site logo

erdemdmr / sample-spring-microservices-advanced Goto Github PK

View Code? Open in Web Editor NEW

This project forked from piomin/sample-spring-microservices-advanced

0.0 1.0 0.0 105 KB

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

Home Page: https://piotrminkowski.wordpress.com/

Java 100.00%

sample-spring-microservices-advanced's Introduction

Microservices with Spring Cloud Advanced Demo Project Twitter

In this project I'm demonstrating you the most interesting features of Spring Cloud Project for building microservice-based architecture to discuss some additional aspects like API documentation, configuration, testing or storing data.

Getting Started

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:

  1. Using Swagger2 for building API documentation and exposing it for all the microservices on API gateway, which is in that case Netlix Zuul. The example is available in the branch master. Detailed description can be found here: Microservices API Documentation with Swagger2
  2. Using Spring Cloud Contract for consumer-driven contract testing in microservices architecture and embedded Mongo simulating database in component testing. The example is available in the branch testing. A detailed description can be found here: Testing Java Microservices.
  3. Using Hoverfly 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 with Eureka discovery. The example is available in the branch hoverfly. A detailed description can be found here: Testing REST API with Hoverfly.
  4. Using Spring 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.

Usage

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 run MongoDB on Docker container, so you also need to have Docker installed on your local machine.

Architecture

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.

sample-spring-microservices-advanced's People

Contributors

piomin avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.