{"id":15014301,"url":"https://github.com/piomin/sample-spring-microservices-new","last_synced_at":"2025-05-14T10:09:12.109Z","repository":{"id":43978897,"uuid":"130051471","full_name":"piomin/sample-spring-microservices-new","owner":"piomin","description":"Demo for Spring Boot 3(`master` branch)/2(other branches) and Spring Cloud microservices with distributed configuration (Spring Cloud Config), service discovery (Eureka), API gateway (Spring Cloud Gateway, Zuul), Swagger/OpenAPI documentation (Springdoc), logs correlation using Spring Cloud Sleuth/Micrometer OTEL and many more","archived":false,"fork":false,"pushed_at":"2025-05-04T23:01:00.000Z","size":310,"stargazers_count":1262,"open_issues_count":7,"forks_count":768,"subscribers_count":65,"default_branch":"master","last_synced_at":"2025-05-05T00:17:57.400Z","etag":null,"topics":["eureka","feign","microservices","netty","ribbon","service-discovery","spring-boot","spring-boot-2","spring-boot-3","spring-cloud","spring-cloud-config","spring-cloud-gateway","spring-cloud-netflix","spring-cloud-sleuth","swagger2","zuul"],"latest_commit_sha":null,"homepage":"https://piotrminkowski.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/piomin.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-04-18T11:23:26.000Z","updated_at":"2025-04-30T15:53:55.000Z","dependencies_parsed_at":"2023-12-03T04:20:24.731Z","dependency_job_id":"82aca75b-965d-4d95-8fc3-142744076b67","html_url":"https://github.com/piomin/sample-spring-microservices-new","commit_stats":{"total_commits":180,"total_committers":7,"mean_commits":"25.714285714285715","dds":"0.34444444444444444","last_synced_commit":"8f3335cc864c389fa8003ea2b908a5319cb66ba3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fsample-spring-microservices-new","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fsample-spring-microservices-new/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fsample-spring-microservices-new/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fsample-spring-microservices-new/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piomin","download_url":"https://codeload.github.com/piomin/sample-spring-microservices-new/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254120161,"owners_count":22017952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eureka","feign","microservices","netty","ribbon","service-discovery","spring-boot","spring-boot-2","spring-boot-3","spring-cloud","spring-cloud-config","spring-cloud-gateway","spring-cloud-netflix","spring-cloud-sleuth","swagger2","zuul"],"created_at":"2024-09-24T19:45:26.392Z","updated_at":"2025-05-14T10:09:12.068Z","avatar_url":"https://github.com/piomin.png","language":"Java","readme":"# Microservices with Spring Cloud Advanced Demo Project [![Twitter](https://img.shields.io/twitter/follow/piotr_minkowski.svg?style=social\u0026logo=twitter\u0026label=Follow%20Me)](https://twitter.com/piotr_minkowski)\n\n[![CircleCI](https://circleci.com/gh/piomin/sample-spring-microservices-new.svg?style=svg)](https://circleci.com/gh/piomin/sample-spring-microservices-new)\n\n[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-black.svg)](https://sonarcloud.io/dashboard?id=piomin_sample-spring-microservices-new)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=piomin_sample-spring-microservices-new\u0026metric=bugs)](https://sonarcloud.io/dashboard?id=piomin_sample-spring-microservices-new)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=piomin_sample-spring-microservices-new\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=piomin_sample-spring-microservices-new)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=piomin_sample-spring-microservices-new\u0026metric=ncloc)](https://sonarcloud.io/dashboard?id=piomin_sample-spring-microservices-new)\n\nIn this project I'm demonstrating you the most interesting features of [Spring Cloud Project](https://spring.io/projects/spring-cloud) for building microservice-based architecture.\n\n-----\n\nI'm publishing on my blog and maintaining example repositories just as a hobby. But if you feel it's worth donating:\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/piotrminkowski)\n\n\n## Getting Started \nCurrently 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:\n1. (This example has been update to the latest version of Spring Cloud without Zuul) Using Spring Cloud Netflix **Eureka** as a discovery server, **Zuul** as a gateway, **OpenFeign** for communication and Spring Cloud Config Server. The example is available in the branch [master](https://github.com/piomin/sample-spring-microservices-new/tree/master). A detailed guide may be find in the following article: [Quick Guide to Microservices with Spring Boot 2.0, Eureka and Spring Cloud](https://piotrminkowski.com/2018/04/26/quick-guide-to-microservices-with-spring-boot-2-0-eureka-and-spring-cloud/)\n2. Using Spring Cloud Alibaba **Nacos** as a discovery and configuration server, **Zuul** and **OpenFeign**. The example is available in the branch [alibaba](https://github.com/piomin/sample-spring-microservices-new/tree/alibaba). A detailed guide may be find in the following article: [Microservices with Spring Cloud Alibaba](https://piotrminkowski.com/2018/11/15/microservices-with-spring-cloud-alibaba/)\n3. Using Spring Cloud with Spring Boot support for **GraphQL** for building microservices, **Apollo** for inter-service communication and **Eureka** as a discovery server. The example is available in the branch [graphql](https://github.com/piomin/sample-spring-microservices-new/tree/graphql). A detailed guide may be find in the following article: [GraphQL – The Future of Microservices?](https://piotrminkowski.com/2018/08/16/graphql-the-future-of-microservices/)\n4. Using Spring Boot and partially Spring Cloud for building microservices deployed on **OpenShift** with **Source-2-Image** mechanism. The example is available in the branch [openshift](https://github.com/piomin/sample-spring-microservices-new/tree/openshift). A detailed guide may be find in the following article: [Running Java Microservices on OpenShift using Source-2-Image](https://piotrminkowski.com/2019/01/08/running-java-microservices-on-openshift-using-source-2-image/)\n5. Using [Trampoline](http://ernestort.github.io/Trampoline/) for managing group of Spring Boot microservices locally. The example is available in the branch [trampoline](https://github.com/piomin/sample-spring-microservices-new/tree/trampoline). A detailed guide may be find in the following article: [Managing Spring Boot apps locally with Trampoline](https://piotrminkowski.com/2018/06/08/managing-spring-boot-apps-locally-with-trampoline/)\n6. Using Spring Boot 3, Micrometer Tracing and Springdoc for building microservices with Spring Cloud. A detailed guide may be found in the following article: [Microservices with Spring Boot 3 and Spring Cloud](https://piotrminkowski.com/2023/03/13/microservices-with-spring-boot-3-and-spring-cloud/)\n\n### Usage\n\nBuild the apps with images (we need ji for `config-service` since it contains `curl`):\n```shell\n$ mvn clean package -Pbuild-image\n```\n\nThen run all the containers with `docker-compose`:\n```shell\n$ docker-compose up\n```\n\n#### Run Locally\n\nTo run locally. Microservices are exposed on dynamic ports, so you can safely run them all on the same workstation.\n\nYou can run Zipkin. However, it is not necessary:\n```shell\ndocker run -d --name zipkin openzipkin/zipkin -p 9411:9411\n```\n\nBegin with `config-service`:\n```shell\ncd config-service\nmvn spring-boot:run\n```\n\nThen, go to `discovery-service`:\n```shell\ncd config-service\nmvn spring-boot:run\n```\n\nThen, go run three microservices: `employee-service`, `department-service`, and `organization-service`, e.g.:\n```shell\ncd employee-service\nmvn spring-boot:run\n```\n\nFinally, run `gateway-service`:\n```shell\ncd gateway-service\nmvn spring-boot:run\n```\n\nBy default, Eureka is running on `8061` port, and gateway is exposed under `8060` port.\\\nYou can access global Swagger UI: http://localhost:8060/swagger-ui.html and switch between services. More details in the articles above.\n\n\nIn the most cases you need to have Maven and JDK8+. In the fourth example with OpenShift you will have to run **Minishift** on your machine. The best way to run the sample applications is with IDEs like IntelliJ IDEA or Eclipse.  \n\n## Architecture\n\nOur sample microservices-based system consists of the following modules:\n- **gateway-service** - a module that Spring Cloud Netflix Zuul for running Spring Boot application that acts as a proxy/gateway in our architecture.\n- **config-service** - a module that uses Spring Cloud Config Server for running configuration server in the `native` mode. The configuration files are placed on the classpath.\n- **discovery-service** - a module that depending on the example it uses Spring Cloud Netflix Eureka or Spring Cloud Netlix Alibaba Nacos as an embedded discovery server.\n- **employee-service** - a module containing the first of our sample microservices that allows to perform CRUD operation on in-memory repository of employees\n- **department-service** - a module containing the second of our sample microservices that allows to perform CRUD operation on in-memory repository of departments. It communicates with employee-service. \n- **organization-service** - a module containing the third of our sample microservices that allows to perform CRUD operation on in-memory repository of organizations. It communicates with both employee-service and organization-service.\n\nThe following picture illustrates the architecture described above.\n\n\u003cimg src=\"https://piotrminkowski.files.wordpress.com/2018/04/spring-cloud-1.png\" title=\"Architecture\"\u003e\u003cbr/\u003e\n\n","funding_links":["https://ko-fi.com/piotrminkowski"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiomin%2Fsample-spring-microservices-new","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiomin%2Fsample-spring-microservices-new","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiomin%2Fsample-spring-microservices-new/lists"}