mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:15:50 +00:00
Jekyll must be run with "bundle exec" command
This commit is contained in:
parent
e7438db1de
commit
416fc924f8
1 changed files with 133 additions and 0 deletions
133
index.html
Normal file
133
index.html
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
---
|
||||||
|
title: Spring PetClinic
|
||||||
|
badges:
|
||||||
|
|
||||||
|
|
||||||
|
# Customize your project's badges. Delete any entries that do not apply.
|
||||||
|
custom:
|
||||||
|
- name: Source (GitHub)
|
||||||
|
url: https://github.com/spring-projects/spring-petclinic
|
||||||
|
icon: github
|
||||||
|
|
||||||
|
- name: StackOverflow
|
||||||
|
url: http://stackoverflow.com/questions/tagged/spring-framework
|
||||||
|
icon: stackoverflow
|
||||||
|
---
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html lang="en-US">
|
||||||
|
|
||||||
|
{% capture billboard_description %}
|
||||||
|
|
||||||
|
PetClinic demonstrates the use of a Spring Boot with Spring MVC and Spring Data. The PetClinic has an old and varied history dating right back to the beginning of the Spring Framework. It started life as a demonstration of nearly all the common things that you could do with Spring, back when it was possible to conceive of such a demonstration. These days it is a very small slice of what you could achieve, but the community has a soft spot for it, so it's nice to see it still going after all this time, so we hope you enjoy it too.
|
||||||
|
|
||||||
|
{% endcapture %}
|
||||||
|
|
||||||
|
{% capture main_content %}
|
||||||
|
> NOTE: This document covers the PetClinic sample application distributed with the Spring Framework 2.5 and earlier. With the introduction of Spring Framework 3.0 this sample application is no longer part of the distribution. The code is now maintained as part of a separate source repository for samples.
|
||||||
|
|
||||||
|
## PetClinic Sample Application Requirements
|
||||||
|
|
||||||
|
The application requirement is for an information system that is accessible through a web browser. The users of the application are employees of the clinic who in the course of their work need to view and manage information regarding the veterinarians, the clients, and their pets. The sample application supports the following:
|
||||||
|
|
||||||
|
### Use Cases
|
||||||
|
|
||||||
|
* View a list of veterinarians and their specialties
|
||||||
|
* View information pertaining to a pet owner
|
||||||
|
* Update the information pertaining to a pet owner
|
||||||
|
* Add a new pet owner to the system
|
||||||
|
* View information pertaining to a pet
|
||||||
|
* Update the information pertaining to a pet
|
||||||
|
* Add a new pet to the system
|
||||||
|
* View information pertaining to a pet's visitation history
|
||||||
|
* Add information pertaining to a visit to the pet's visitation history
|
||||||
|
|
||||||
|
### Business Rules
|
||||||
|
|
||||||
|
An owner may not have multiple pets with the same case-insensitive name.
|
||||||
|
|
||||||
|
## PetClinic Sample Application Design & Implementation
|
||||||
|
|
||||||
|
### Server Technology
|
||||||
|
|
||||||
|
The sample application uses Spring Boot with an embedded Tomcat container, and it should be usable with Java version 1.8 or greater. Other embedded containers can be used by changing the build configuration, or you could build a WAR file and deploy the application to standard Servlet 3.0 containers. Configuration details are provided in the Developer Instructions section. The view technologies that are to be used for rendering the application is Thymeleaf.
|
||||||
|
|
||||||
|
### Database Technology
|
||||||
|
|
||||||
|
The sample application uses a relational database for data storage. Support has been provided for a choice of 1 of 2 database selections, MySql or HypersonicSQL. HypersonicSQL is the default choice and a copy is provided with the application. It is possible to easily configure the application to use either database. Configuration details are provided in the Developer Instructions section.
|
||||||
|
|
||||||
|
### Development Environment
|
||||||
|
|
||||||
|
You will need a Java SDK 1.8.x or better. To build and run the application use the Maven wrapper provided:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ git clone https://github.com/spring-projects/spring-petclinic
|
||||||
|
$ cd spring-petclinic
|
||||||
|
$ ./mvnw spring-boot:run
|
||||||
|
```
|
||||||
|
|
||||||
|
and the application will be available on http://localhost:8080. Alternatively, instead of using the command line, you can import the code into an IDE and run the main method in the `PetClinicApplication` class.
|
||||||
|
|
||||||
|
### PetClinic Database
|
||||||
|
|
||||||
|
The following is an overview of the database schema used in PetClinic. The database schema is actually automatically generated by Hibernate, so there might be some small differences in names and table metadata. All "id" key fields are of Java type int.
|
||||||
|
|
||||||
|
```
|
||||||
|
TABLE: owners
|
||||||
|
PRIMARY KEY id
|
||||||
|
|
||||||
|
TABLE: types
|
||||||
|
PRIMARY KEY id
|
||||||
|
|
||||||
|
TABLE: pets
|
||||||
|
PRIMARY KEY id
|
||||||
|
FOREIGN KEY type_id references the types table id field
|
||||||
|
FOREIGN KEY owner_id references the owners table id field
|
||||||
|
|
||||||
|
TABLE: vets
|
||||||
|
PRIMARY KEY id
|
||||||
|
|
||||||
|
TABLE: specialties
|
||||||
|
PRIMARY KEY id
|
||||||
|
TABLE: vet_specialties - a link table for vets and their specialties
|
||||||
|
FOREIGN KEY vet_id references the vets table id field
|
||||||
|
FOREIGN KEY specialty_id references the specialties table id field
|
||||||
|
|
||||||
|
TABLE: visits
|
||||||
|
PRIMARY KEY id
|
||||||
|
FOREIGN KEY pet_id references the pets table id field
|
||||||
|
```
|
||||||
|
|
||||||
|
## PetClinic Application Design
|
||||||
|
|
||||||
|
### Logging
|
||||||
|
|
||||||
|
Spring Boot supports the use of a range of logging libraries. By default it makes it easiest to use logback (slf4j). You can change log levels in `application.properties` using `logging.levels.<logger-name>=(DEBUG|INFO|WARN|ERROR)`.
|
||||||
|
|
||||||
|
### Business Layer
|
||||||
|
|
||||||
|
The Business Layer consists of a number of basic classes representing the application domain objects and associated validation objects that are used by the Presentation Layer.
|
||||||
|
|
||||||
|
Since the PetClinic application is all about database access and there is very little business logic in the application outside of that, there is no separation of the primary Business and Persistence Layer API's. The most important facet of the design is that the Business and Persistence Layers are COMPLETELY independent of the Presentation Layer.
|
||||||
|
|
||||||
|
### Presentation Layer
|
||||||
|
|
||||||
|
The Presentation Layer is implemented as a Spring MVC Application and provides a very thin and concise user interface to the Business and Persistence Layers. It uses thymeleaf as the View rendering technology. Thymeleaf templates can be found in `src/main/resources/templates`.
|
||||||
|
|
||||||
|
#### Messages
|
||||||
|
|
||||||
|
The messages*.properties files are loaded from the classpath to provide localized messages for the supported languages. PetClinic supplies a localized "welcome" message as well as localized form entry error messages in the default (i.e., English) and German properties files. See the "countries" sample application for a more detailed example of Spring's support for internationalization.
|
||||||
|
{% endcapture %}
|
||||||
|
|
||||||
|
{% capture related_resources %}
|
||||||
|
|
||||||
|
### Spring Projects
|
||||||
|
|
||||||
|
* [Spring Boot](https://projects.spring.io/spring-boot)
|
||||||
|
* [Spring Framework](https://projects.spring.io/spring-framework)
|
||||||
|
* [Spring Data](https://projects.spring.io/spring-data)
|
||||||
|
|
||||||
|
|
||||||
|
{% endcapture %}
|
||||||
|
|
||||||
|
{% include project_page.html %}
|
||||||
|
</html>
|
Loading…
Reference in a new issue