This is a dockerized version of the original app published by Spring Boot community.
Petclinic is a Spring Boot application built using Maven. It is an application designed to show how the Spring stack can be used to build simple, but powerful database-oriented applications. The official version of PetClinic demonstrates the use of Spring Boot with Spring MVC and Spring Data JPA.
Spring boot works with MVC (Model-View-Controller) is a pattern in software design commonly used to implement user interfaces, data and control logic. It emphasizes a separation between business logic and its visualization. This "separation of concerns" provides a better division of labor and improved maintenance.We can work with the persistence or data access layer with spring-data in a simple and very fast way, without the need to create so many classes manually. Spring data comes with built-in methods below or by default that allow you to save, delete, update and/or create.
git clone https://github.com/dockersamples/spring-petclinic.git
cd spring-petclinic
./mvnw package
java -jar target/*.jar
You can then access petclinic here: http://localhost:8080/
The applications allows you to perform the following set of functions:
- Add Pets
- Add Owners
- Finding Owners
- Finding Veterinarians
- Exceptional handling
Or you can run it from Maven directly using the Spring Boot Maven plugin. If you do this it will pick up changes that you make in the project immediately (changes to Java source files require a compile as well - most people use an IDE for this):
./mvnw spring-boot:run
NOTE: Windows users should set
git config core.autocrlf true
to avoid format assertions failing the build (use--global
to set that flag globally).
NOTE: If you prefer to use Gradle, you can build the app using
./gradlew build
and look for the jar file inbuild/libs
.
docker build -t petclinic-app . -f Dockerfile
docker build -t petclinic-app . -f Dockerfile.multi
docker-compose up -d