spring-petclinic
A sample Spring-based application
A sample veterinary clinic web app built with Spring Boot, maintained by the Spring team as a teaching reference for Java developers learning how to structure a real Spring application.
Spring PetClinic is a sample web application maintained by the Spring team at VMware. It models a simple veterinary clinic where staff can manage records for pet owners and their animals, track visits, and look up vets. The app exists primarily as a teaching tool and reference project for Java developers learning the Spring framework, which is one of the most widely used platforms for building Java-based server applications.
The application is built with Spring Boot, a version of the Spring framework that reduces setup and configuration work. It uses Java on the backend and stores data in a database. By default it uses an in-memory database that resets each time the app restarts, but it can also be configured to use MySQL or PostgreSQL for persistent storage. The front end is standard HTML with some styling applied using Bootstrap.
Developers can run the project locally by cloning the code, installing Java 17 or later, and starting it with a single command. It then runs in a browser at a local address. It can also be opened directly in GitHub Codespaces or Gitpod, which are cloud-based coding environments, without any local setup. Instructions are provided for IntelliJ IDEA, Eclipse, Spring Tools Suite, and VS Code.
Beyond the main version, the README lists several forks and variants of PetClinic that demonstrate different architectural styles, such as splitting the app into microservices, using reactive programming, or swapping in alternative databases. These variants are maintained separately and serve as comparison points for developers exploring different design approaches.
This project is intended for developers, not general users. It does not solve a real business problem on its own but illustrates how a real Spring-based application is structured.
Where it fits
- Run the app locally with a single command to study how a complete Spring Boot project is structured end to end.
- Switch from the default in-memory database to MySQL or PostgreSQL to learn how to add persistent storage to a Spring Boot app.
- Use one of the linked variant forks to compare microservices, reactive, or alternative-database architectural styles against the baseline.