All Projects → spring-petclinic → Spring Petclinic Rest

spring-petclinic / Spring Petclinic Rest

Licence: apache-2.0
REST version of the Spring Petclinic sample application

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Spring Petclinic Rest

Angularjs Springmvc Sample Boot
A RESTful sample using Spring Boot, Spring MVC, Spring Data and Angular/Bootstrap.
Stars: ✭ 309 (+20.23%)
Mutual labels:  rest, swagger, hibernate, spring-data-jpa, spring-data, spring, spring-mvc
Spring Framework Petclinic
A Spring Framework application based on JSP, Spring MVC, Spring Data JPA, Hibernate and JDBC
Stars: ✭ 251 (-2.33%)
Mutual labels:  hibernate, spring-data-jpa, spring, spring-mvc, springframework, sample
Spring Mvc Thymeleaf Crud
Spring MVC CRUD Application with Thymeleaf, HTML5, CSS3 and Bootstrap
Stars: ✭ 14 (-94.55%)
Mutual labels:  spring-data-jpa, spring-data, spring, spring-mvc, springframework
BusinessInfrastructurePlatformGroupVersion
A java web project based on Spring Boot using MySQL, Spring MVC, Hibernate, Spring Data JPA, Query DSL, Lombok, Logback, etc.
Stars: ✭ 90 (-64.98%)
Mutual labels:  spring-data, hibernate, springframework, spring-mvc, spring-data-jpa
Gemini
Model Driven REST framework to automatically generate CRUD APIs
Stars: ✭ 138 (-46.3%)
Mutual labels:  rest-api, rest, swagger, spring, spring-mvc
Spring Boot Mysql Rest Api Tutorial
Building a Restful CRUD API using Spring Boot, Mysql, JPA and Hibernate
Stars: ✭ 279 (+8.56%)
Mutual labels:  rest-api, hibernate, spring-data-jpa, spring, spring-mvc
Javaquarkbbs
基于Spring Boot实现的一个简易的Java社区
Stars: ✭ 755 (+193.77%)
Mutual labels:  swagger, hibernate, spring, spring-mvc
Spring Boot Postgresql Jpa Hibernate Rest Api Demo
Building RESTful APIs with Spring Boot, PostgreSQL, JPA and Hibernate
Stars: ✭ 209 (-18.68%)
Mutual labels:  rest-api, rest, hibernate, spring
Spring5Certification
Spring Certification: This repository contains my examples and some best references to prepare the Spring 5 certification
Stars: ✭ 30 (-88.33%)
Mutual labels:  spring-data, springframework, spring-mvc, spring-data-jpa
Spring-Boot-2
Spring Boot 2.x examples
Stars: ✭ 33 (-87.16%)
Mutual labels:  spring-data, hibernate, spring-mvc, spring-data-jpa
Springboard
Spring Boot based production grade starter kit.
Stars: ✭ 59 (-77.04%)
Mutual labels:  spring-data-jpa, spring, spring-mvc, springframework
Springbootunity
rabbitmq、redis、scheduled、socket、mongodb、Swagger2、spring data jpa、Thymeleaf、freemarker etc. (muti module spring boot project) (with spring boot framework,different bussiness scence with different technology。)
Stars: ✭ 845 (+228.79%)
Mutual labels:  swagger, hibernate, spring, spring-mvc
Spring
Personal notes of preparation to Spring 5 Professional Certification
Stars: ✭ 35 (-86.38%)
Mutual labels:  spring-data, springframework, spring-mvc, spring-data-jpa
Quickperf
QuickPerf is a testing library for Java to quickly evaluate and improve some performance-related properties
Stars: ✭ 231 (-10.12%)
Mutual labels:  hibernate, jdbc, spring-data-jpa, spring
Library
Online Library Management. User can search, check in, checkout book. System adds fines automatically if the book is not checked in by due date
Stars: ✭ 27 (-89.49%)
Mutual labels:  spring-data, hibernate, spring-mvc, spring-data-jpa
Spring Cloud Flycloud
🔥🔥🔥FlyClould 微服务实战项目框架,在该框架中,包括了用 Spring Cloud 构建微服务的一系列基本组件和框架,对于后台服务框架的搭建有很大的参考价值,大家可以参考甚至稍加修改可以直接应用于自己的实际的项目开发中,该项目没有采用Maven进行项目构建,Maven通过xml进行依赖管理,导致整个配置文件太过臃肿,另外灵活性也不是很强,所以我采用Gradle进行项目构建和依赖管理,在FlyTour项目中我们见证了Gradle的强大,通过简单的一些配置就可以轻松的实现组件化的功能。该项目共有11个Module工程。其中10个位微服务工程,这10个微服务工程构成了一个完整的微服务系统,微服务系统包含了8个基础服务,提供了一整套微服务治理功能,他们分别是配置中心module_c…
Stars: ✭ 1,514 (+489.11%)
Mutual labels:  spring-data-jpa, spring, spring-mvc, springframework
Java Course
Self paced course for Java Engineers
Stars: ✭ 103 (-59.92%)
Mutual labels:  rest-api, hibernate, jdbc, spring-mvc
Jersey Jwt
Example of REST API with JWT authentication using Jersey, Jackson, Undertow, Weld, Hibernate and Arquillian.
Stars: ✭ 131 (-49.03%)
Mutual labels:  rest-api, rest, hibernate, jackson
Javadevjournal
Source code for the tutorials published on the Javadevjournal site.
Stars: ✭ 141 (-45.14%)
Mutual labels:  rest-api, rest, spring-data-jpa, spring-mvc
Hikaku
A library that tests if the implementation of a REST-API meets its specification.
Stars: ✭ 154 (-40.08%)
Mutual labels:  rest-api, rest, spring, spring-mvc

REST version of Spring PetClinic Sample Application (spring-framework-petclinic extend ) Build Status

This backend version of the Spring Petclinic application only provides a REST API. There is no UI. The spring-petclinic-angular project is a Angular front-end application which consumes the REST API.

Understanding the Spring Petclinic application with a few diagrams

See the presentation of the Spring Petclinic Framework version

Petclinic ER Model

alt petclinic-ermodel

Running petclinic locally

With maven command line

git clone https://github.com/spring-petclinic/spring-petclinic-rest.git
cd spring-petclinic-rest
./mvnw spring-boot:run

With Docker

docker run -p 9966:9966 springcommunity/spring-petclinic-rest

You can then access petclinic here: http://localhost:9966/petclinic/

Swagger REST API documentation presented here (after application start):

http://localhost:9966/petclinic/swagger-ui.html

Screenshot of the Angular client

spring-petclinic-angular2

In case you find a bug/suggested improvement for Spring Petclinic

Our issue tracker is available here: https://github.com/spring-petclinic/spring-petclinic-rest/issues

Database configuration

In its default configuration, Petclinic uses an in-memory database (HSQLDB) which gets populated at startup with data. A similar setups is provided for MySql and PostgreSQL in case a persistent database configuration is needed. To run petclinic locally using persistent database, it is needed to change profile defined in application.properties file.

For MySQL database, it is needed to change param "hsqldb" to "mysql" in string

spring.profiles.active=hsqldb,spring-data-jpa

defined in application.properties file.

Before do this, would be good to check properties defined in application-mysql.properties file.

spring.datasource.url = jdbc:mysql://localhost:3306/petclinic?useUnicode=true
spring.datasource.username=pc
spring.datasource.password=petclinic 
spring.datasource.driver-class-name=com.mysql.jdbc.Driver 
spring.jpa.database=MYSQL
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.hibernate.ddl-auto=none

You may also start a MySql database with docker:

docker run --name mysql-petclinic -e MYSQL_ROOT_PASSWORD=petclinic -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:5.7.8

For PostgeSQL database, it is needed to change param "hsqldb" to "postgresql" in string

spring.profiles.active=hsqldb,spring-data-jpa

defined in application.properties file.

Before do this, would be good to check properties defined in application-postgresql.properties file.

spring.datasource.url=jdbc:postgresql://localhost:5432/petclinic
spring.datasource.username=postgres
spring.datasource.password=petclinic
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.database=POSTGRESQL
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=none

You may also start a Postgres database with docker:

docker run --name postgres-petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 -d postgres:9.6.0

Security configuration

In its default configuration, Petclinic doesn't have authentication and authorization enabled.

Basic Authentication

In order to use the basic authentication functionality, turn in on from the application.properties file

petclinic.security.enable=true

This will secure all APIs and in order to access them, basic authentication is required. Apart from authentication, APIs also require authorization. This is done via roles that a user can have. The existing roles are listed below with the corresponding permissions

  • OWNER_ADMIN -> OwnerController, PetController, PetTypeController (getAllPetTypes and getPetType), VisitController
  • VET_ADMIN -> PetTypeController, SpecialityController, VetController
  • ADMIN -> UserController

There is an existing user with the username admin and password admin that has access to all APIs. In order to add a new user, please use the following API:

POST /api/users
{
    "username": "secondAdmin",
    "password": "password",
    "enabled": true,
    "roles": [
    	{ "name" : "OWNER_ADMIN" }
	]
}

Working with Petclinic in Eclipse/STS

prerequisites

The following items should be installed in your system:

Note: when m2e is available, there is an m2 icon in Help -> About dialog. If m2e is not there, just follow the install process here: http://eclipse.org/m2e/download/

Steps:

  1. In the command line
git clone https://github.com/spring-petclinic/spring-petclinic-rest.git
  1. Inside Eclipse
File -> Import -> Maven -> Existing Maven project

Looking for something in particular?

Layer Source
REST API controllers REST folder
Service ClinicServiceImpl.java
JDBC jdbc folder
JPA jpa folder
Spring Data JPA springdatajpa folder
Tests AbstractClinicServiceTests.java

Publishing a Docker image

This application uses Google Jib to build an optimized Docker image into the Docker Hub repository. The pom.xml has been configured to publish the image with a the springcommunity/spring-petclinic-restimage name.

Interesting Spring Petclinic forks

The Spring Petclinic master branch in the main spring-projects GitHub org is the "canonical" implementation, currently based on Spring Boot and Thymeleaf.

This spring-petclinic-rest project is one of the several forks hosted in a special GitHub org: spring-petclinic. If you have a special interest in a different technology stack that could be used to implement the Pet Clinic then please join the community there.

Contributing

The issue tracker is the preferred channel for bug reports, features requests and submitting pull requests.

For pull requests, editor preferences are available in the editor config for easy use in common text editors. Read more and download plugins at http://editorconfig.org.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].