spring-petclinic-microservices  by spring-petclinic

Microservices app using Spring Cloud and Spring AI

created 8 years ago
1,899 stars

Top 23.4% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a distributed version of the Spring PetClinic sample application, refactored into microservices using Spring Cloud and Spring AI. It's designed for developers and architects looking to understand and implement microservice patterns, service discovery, distributed configuration, and integrate AI chatbots within a familiar Java ecosystem. The primary benefit is a practical, runnable example of a complex distributed system.

How It Works

The application is composed of several Spring Boot microservices (Customers, Vets, Visits, GenAI) communicating via REST APIs. It leverages Spring Cloud technologies for essential microservice capabilities: Eureka for service discovery, Spring Cloud Gateway as an API gateway, Spring Cloud Config for centralized configuration, and Resilience4j for circuit breaking. The GenAI service integrates with OpenAI or Azure OpenAI for natural language interaction with the application data.

Quick Start & Requirements

  • Local Setup: Start supporting services (Config, Discovery) first, then other microservices. Access services via provided URLs (e.g., Discovery Server at http://localhost:8761).
  • Docker Compose: Build images with ./mvnw clean install -P buildDocker (supports Podman via -Dcontainer.executable=podman and custom platforms via -Dcontainer.platform). Then run with docker compose up or podman-compose up.
  • Prerequisites: Java 17, Maven, Docker or Podman. OpenAI/Azure OpenAI API key for GenAI service.
  • Resources: Sufficient memory for Docker VM on macOS/Windows.
  • Docs: Spring Petclinic Microservices

Highlighted Details

  • Demonstrates integration of Spring AI for a chatbot interface.
  • Includes comprehensive monitoring with Grafana and Prometheus, instrumented via Micrometer.
  • Supports both in-memory HSQLDB and persistent MySQL databases.
  • Offers Chaos Monkey integration for resilience testing.

Maintenance & Community

The project is part of the spring-petclinic GitHub organization, indicating community involvement and potential support from the Spring ecosystem. The issue tracker is the preferred channel for bug reports and feature requests.

Licensing & Compatibility

The project appears to be licensed under the Apache License 2.0, which is permissive and generally compatible with commercial use and closed-source linking.

Limitations & Caveats

Initial startup of the API Gateway might experience timeouts as it syncs with the service registry. The GenAI service requires external API keys for full functionality, though a demo key is available for limited testing.

Health Check
Last commit

3 months ago

Responsiveness

Inactive

Pull Requests (30d)
10
Issues (30d)
0
Star History
78 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.