{"id":21304895,"url":"https://github.com/parasoft/spring-petclinic-microservices","last_synced_at":"2025-10-26T02:12:25.473Z","repository":{"id":197015778,"uuid":"697810194","full_name":"parasoft/spring-petclinic-microservices","owner":"parasoft","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-09T15:56:54.000Z","size":28332,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-15T19:31:34.998Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parasoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-09-28T14:19:30.000Z","updated_at":"2024-08-09T15:56:58.000Z","dependencies_parsed_at":"2023-09-28T17:12:45.374Z","dependency_job_id":"ee4a649d-622d-46ba-8e55-42f241976a38","html_url":"https://github.com/parasoft/spring-petclinic-microservices","commit_stats":null,"previous_names":["parasoft/spring-petclinic-microservices"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/parasoft/spring-petclinic-microservices","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parasoft%2Fspring-petclinic-microservices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parasoft%2Fspring-petclinic-microservices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parasoft%2Fspring-petclinic-microservices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parasoft%2Fspring-petclinic-microservices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parasoft","download_url":"https://codeload.github.com/parasoft/spring-petclinic-microservices/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parasoft%2Fspring-petclinic-microservices/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281047743,"owners_count":26435124,"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","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-21T16:16:19.244Z","updated_at":"2025-10-26T02:12:25.446Z","avatar_url":"https://github.com/parasoft.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Distributed version of the Spring PetClinic Sample Application built with Spring Cloud \n\n[![Build Status](https://github.com/spring-petclinic/spring-petclinic-microservices/actions/workflows/maven-build.yml/badge.svg)](https://github.com/spring-petclinic/spring-petclinic-microservices/actions/workflows/maven-build.yml)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nThis microservices branch was initially derived from [AngularJS version](https://github.com/spring-petclinic/spring-petclinic-angular1) to demonstrate how to split sample Spring application into [microservices](http://www.martinfowler.com/articles/microservices.html).\nTo achieve that goal, we use Spring Cloud Gateway, Spring Cloud Circuit Breaker, Spring Cloud Config, Micrometer Tracing, Resilience4j, Open Telemetry \nand the Eureka Service Discovery from the [Spring Cloud Netflix](https://github.com/spring-cloud/spring-cloud-netflix) technology stack.\n\n## Starting services with Parasoft coverage agent for Java\n\nFour microservice projects have been configured with Parasoft coverage agent properties.  All you need to do is copy the agent.jar, opentelemetry-javaagent.jar and   jtest-otel-ext.jar files into the src/test/resources/coverage/ folder along side the existing agent.properties.  Maven will automatically pick up the Java agent and inject it into the Spring Boot runtime.  Coverage agent port numbers for each microservice are configured in src/test/resources/coverage/agent.properties files.  Follow the instructions below to start each microservice using `..\\mvnw spring-boot:run` command in a separate terminal and in the correct order to run them with the coverage agent.  The four microservice projects configured for coverage are:\n* spring-petclinic-api-gateway\n* spring-petclinic-customers-service\n* spring-petclinic-vets-service\n* spring-petclinic-visits-service\n\n## Starting services locally without Docker\n\nEvery microservice is a Spring Boot application and can be started locally using IDE ([Lombok](https://projectlombok.org/) plugin has to be set up) or `../mvnw spring-boot:run` command. Please note that supporting services (Config and Discovery Server) must be started before any other application (Customers, Vets, Visits and API).\nStartup of Tracing server, Admin server, Grafana and Prometheus is optional.\nIf everything goes well, you can access the following services at given location:\n* Discovery Server - http://localhost:8761\n* Config Server - http://localhost:8888\n* AngularJS frontend (API Gateway) - http://localhost:8080\n* Customers, Vets and Visits Services - random port, check Eureka Dashboard \n* Tracing Server (Zipkin) - http://localhost:9411/zipkin/ (we use [openzipkin](https://github.com/openzipkin/zipkin/tree/master/zipkin-server))\n* Admin Server (Spring Boot Admin) - http://localhost:9090\n* Grafana Dashboards - http://localhost:3000\n* Prometheus - http://localhost:9091\n\nYou can tell Config Server to use your local Git repository by using `native` Spring profile and setting\n`GIT_REPO` environment variable, for example:\n`-Dspring.profiles.active=native -DGIT_REPO=/projects/spring-petclinic-microservices-config`\n\n## Starting services locally with docker-compose\nIn order to start entire infrastructure using Docker, you have to build images by executing `./mvnw clean install -P buildDocker` \nfrom a project root. Once images are ready, you can start them with a single command\n`docker-compose up`. Containers startup order is coordinated with [`dockerize` script](https://github.com/jwilder/dockerize). \nAfter starting services, it takes a while for API Gateway to be in sync with service registry,\nso don't be scared of initial Spring Cloud Gateway timeouts. You can track services availability using Eureka dashboard\navailable by default at http://localhost:8761.\n\nThe `master` branch uses an Eclipse Temurin with Java 17 as Docker base image.\n\n*NOTE: Under MacOSX or Windows, make sure that the Docker VM has enough memory to run the microservices. The default settings\nare usually not enough and make the `docker-compose up` painfully slow.*\n\n\n## Starting services locally with docker-compose and Java\nIf you experience issues with running the system via docker-compose you can try running the `./scripts/run_all.sh` script that will start the infrastructure services via docker-compose and all the Java based applications via standard `nohup java -jar ...` command. The logs will be available under `${ROOT}/target/nameoftheapp.log`. \n\nEach of the java based applications is started with the `chaos-monkey` profile in order to interact with Spring Boot Chaos Monkey. You can check out the (README)[scripts/chaos/README.md] for more information about how to use the `./scripts/chaos/call_chaos.sh` helper script to enable assaults.\n\n## Understanding the Spring Petclinic application\n\n[See the presentation of the Spring Petclinic Framework version](http://fr.slideshare.net/AntoineRey/spring-framework-petclinic-sample-application)\n\n[A blog post introducing the Spring Petclinic Microsevices](http://javaetmoi.com/2018/10/architecture-microservices-avec-spring-cloud/) (french language)\n\nYou can then access petclinic here: http://localhost:8080/\n\n![Spring Petclinic Microservices screenshot](docs/application-screenshot.png)\n\n\n**Architecture diagram of the Spring Petclinic Microservices**\n\n![Spring Petclinic Microservices architecture](docs/microservices-architecture-diagram.jpg)\n\n**CTP environment diagram of the Spring Petclinic Microservices**\n\n![Spring Petclinic Microservices environment](docs/ctp-environment.png)\n\nImport `ctp-system.zip` from this Git repo into your CTP to quickly set up the above diagram.\n\n## Selenium web functional tests integrated with CTP\n\nSee the `spring-petclinic-selenium-tests` project for sample Selenium tests configured to report test results and associated coverage to the CTP REST API at http://localhost:8081/em/api\n\n\n## In case you find a bug/suggested improvement for Spring Petclinic Microservices\n\nOur issue tracker is available here: https://github.com/spring-petclinic/spring-petclinic-microservices/issues\n\n## Database configuration\n\nIn its default configuration, Petclinic uses an in-memory database (HSQLDB) which gets populated at startup with data.\nA similar setup is provided for MySql in case a persistent database configuration is needed.\nDependency for Connector/J, the MySQL JDBC driver is already included in the `pom.xml` files.\n\n### Start a MySql database\n\nYou may start a MySql database with docker:\n\n```\ndocker run -e MYSQL_ROOT_PASSWORD=petclinic -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:5.7.8\n```\nor download and install the MySQL database (e.g., MySQL Community Server 5.7 GA), which can be found here: https://dev.mysql.com/downloads/\n\n### Use the Spring 'mysql' profile\n\nTo use a MySQL database, you have to start 3 microservices (`visits-service`, `customers-service` and `vets-services`)\nwith the `mysql` Spring profile. Add the `--spring.profiles.active=mysql` as programm argument.\n\nBy default, at startup, database schema will be created and data will be populated.\nYou may also manually create the PetClinic database and data by executing the `\"db/mysql/{schema,data}.sql\"` scripts of each 3 microservices. \nIn the `application.yml` of the [Configuration repository], set the `initialization-mode` to `never`.\n\nIf you are running the microservices with Docker, you have to add the `mysql` profile into the (Dockerfile)[docker/Dockerfile]:\n```\nENV SPRING_PROFILES_ACTIVE docker,mysql\n```\nIn the `mysql section` of the `application.yml` from the [Configuration repository], you have to change \nthe host and port of your MySQL JDBC connection string. \n\n## Custom metrics monitoring\n\nGrafana and Prometheus are included in the `docker-compose.yml` configuration, and the public facing applications\nhave been instrumented with [MicroMeter](https://micrometer.io) to collect JVM and custom business metrics.\n\nA JMeter load testing script is available to stress the application and generate metrics: [petclinic_test_plan.jmx](spring-petclinic-api-gateway/src/test/jmeter/petclinic_test_plan.jmx)\n\n![Grafana metrics dashboard](docs/grafana-custom-metrics-dashboard.png)\n\n### Using Prometheus\n\n* Prometheus can be accessed from your local machine at http://localhost:9091\n\n### Using Grafana with Prometheus\n\n* An anonymous access and a Prometheus datasource are setup.\n* A `Spring Petclinic Metrics` Dashboard is available at the URL http://localhost:3000/d/69JXeR0iw/spring-petclinic-metrics.\nYou will find the JSON configuration file here: [docker/grafana/dashboards/grafana-petclinic-dashboard.json]().\n* You may create your own dashboard or import the [Micrometer/SpringBoot dashboard](https://grafana.com/dashboards/4701) via the Import Dashboard menu item.\nThe id for this dashboard is `4701`.\n\n### Custom metrics\nSpring Boot registers a lot number of core metrics: JVM, CPU, Tomcat, Logback... \nThe Spring Boot auto-configuration enables the instrumentation of requests handled by Spring MVC.\nAll those three REST controllers `OwnerResource`, `PetResource` and `VisitResource` have been instrumented by the `@Timed` Micrometer annotation at class level.\n\n* `customers-service` application has the following custom metrics enabled:\n  * @Timed: `petclinic.owner`\n  * @Timed: `petclinic.pet`\n* `visits-service` application has the following custom metrics enabled:\n  * @Timed: `petclinic.visit`\n\n## Looking for something in particular?\n\n| Spring Cloud components         | Resources  |\n|---------------------------------|------------|\n| Configuration server            | [Config server properties](spring-petclinic-config-server/src/main/resources/application.yml) and [Configuration repository] |\n| Service Discovery               | [Eureka server](spring-petclinic-discovery-server) and [Service discovery client](spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/VetsServiceApplication.java) |\n| API Gateway                     | [Spring Cloud Gateway starter](spring-petclinic-api-gateway/pom.xml) and [Routing configuration](/spring-petclinic-api-gateway/src/main/resources/application.yml) |\n| Docker Compose                  | [Spring Boot with Docker guide](https://spring.io/guides/gs/spring-boot-docker/) and [docker-compose file](docker-compose.yml) |\n| Circuit Breaker                 | [Resilience4j fallback method](spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/boundary/web/ApiGatewayController.java)  |\n| Grafana / Prometheus Monitoring | [Micrometer implementation](https://micrometer.io/), [Spring Boot Actuator Production Ready Metrics] |\n\n Front-end module  | Files |\n|-------------------|-------|\n| Node and NPM      | [The frontend-maven-plugin plugin downloads/installs Node and NPM locally then runs Bower and Gulp](spring-petclinic-ui/pom.xml)  |\n| Bower             | [JavaScript libraries are defined by the manifest file bower.json](spring-petclinic-ui/bower.json)  |\n| Gulp              | [Tasks automated by Gulp: minify CSS and JS, generate CSS from LESS, copy other static resources](spring-petclinic-ui/gulpfile.js)  |\n| Angular JS        | [app.js, controllers and templates](spring-petclinic-ui/src/scripts/)  |\n\n\n## Interesting Spring Petclinic forks\n\nThe Spring Petclinic `main` branch in the main [spring-projects](https://github.com/spring-projects/spring-petclinic)\nGitHub org is the \"canonical\" implementation, currently based on Spring Boot and Thymeleaf.\n\nThis [spring-petclinic-microservices](https://github.com/spring-petclinic/spring-petclinic-microservices/) project is one of the [several forks](https://spring-petclinic.github.io/docs/forks.html) \nhosted in a special GitHub org: [spring-petclinic](https://github.com/spring-petclinic).\nIf you have a special interest in a different technology stack\nthat could be used to implement the Pet Clinic then please join the community there.\n\n\n# Contributing\n\nThe [issue tracker](https://github.com/spring-petclinic/spring-petclinic-microservices/issues) is the preferred channel for bug reports, features requests and submitting pull requests.\n\nFor pull requests, editor preferences are available in the [editor config](.editorconfig) for easy use in common text editors. Read more and download plugins at \u003chttp://editorconfig.org\u003e.\n\n\n[Configuration repository]: https://github.com/spring-petclinic/spring-petclinic-microservices-config\n[Spring Boot Actuator Production Ready Metrics]: https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-metrics.html\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparasoft%2Fspring-petclinic-microservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparasoft%2Fspring-petclinic-microservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparasoft%2Fspring-petclinic-microservices/lists"}