spring-projects / spring-petclinic
git clone https://github.com/spring-projects/spring-petclinic.git
🔥 on GitHub Trending today
A sample Spring-based application
—
stars, 24h
—
stars, 7 days
+75
stars, 30 days · #2,968
9.6k
★ total
31k
forks · 14 open issues
Star history starts 2026-10-20; the chart appears after the second daily snapshot.
LanguageCSS
LicenseApache-2.0
Created2013-01-09 (13y ago)
Last push21d ago
Watchers365
OwnerOrganization
Seen on GitHub Trending
- 2026-10-20 — #4 monthly in css · +75 ★
Links
README excerpt
# Spring PetClinic Sample Application ## Understanding the Spring Petclinic application with a few diagrams See the presentation here: Spring Petclinic Sample Application (legacy slides) > **Note:** These slides refer to a legacy, pre–Spring Boot version of Petclinic and may not reflect the current Spring Boot–based implementation. > For up-to-date information, please refer to this repository and its documentation. ## Run Petclinic locally Spring Petclinic is a Spring Boot application built using Maven or Gradle. Java 17 or later is required for the build, and the application can run with Java 17 or newer. You first need to clone the project locally: [code] If you are using Maven, you can start the application on the command-line as follows: [code] With Gradle, the command is as follows: [code] You can then access the Petclinic at . You can, of course, run Petclinic in your favorite IDE. See below for more details. ## Building a Container There is no `Dockerfile` in this project. You can build a container image (if you have a docker daemon) using the Spring Boot build plugin: [code] ## Running the Container Image [code] ## In case you find a bug/suggested improvement for Spring Petclinic Our issue tracker is available here. ## Database configuration In its default configuration, Petclinic uses an in-memory database (H2) which gets populated at startup with data. The h2 console is exposed at `http://localhost:8080/h2-console`, and it is possible to inspect the content of the database using the `jdbc:h2:mem: ` URL. The UUID is printed at startup to the console. A similar setup is provided for MySQL and PostgreSQL if a persistent database configuration is needed. Note that whenever the database type changes, the app needs to run with a different profile: `spring.profiles.active=mysql` for MySQL or `spring.profiles.active=postgres` for PostgreSQL. See the Spring Boot documentation for more detail on how to set the active profile. You can start MySQL or PostgreSQL locally with whatever installer works for your OS or use docker: [code] or [code] Further documentation is provided for MySQL and PostgreSQL. Instead of vanilla `docker` you can also use the provided `docker-compose.yml` file to start the database containers. Each one has a service named after the Spring profile: [code] or [code] ## Test Applications At development time we recommend you use the test applications set up as `main()` methods in `PetClinicIntegrationTests` (using the default H2 database and also adding Spring Boot Devtools), `MySqlTestApplication` and `PostgresIntegrationTests`. These are set up so that you can run the apps in your IDE to get fast feedback and also run the same classes as integration tests against the respective database. The MySql integration tests use Testcontainers to start the database in a Docker container, and the Postgres tests use Docker Compose to do the same thing. ## Compiling the CSS There is a `petclinic.css` in `src/main/resour