Developers familiar with the spring framework are no strangers to their famous spring-petclinic applications. Based on Spring-petclinic, Nils has developed a SPRING-PETCLINIC-GRAPHQL application combining GRAPHQL characteristics, which is explained in detail in this paper.
1. The composition of the SPRING-PETCLINIC-GRAPHQL backend, using Graphql-java implementation of the GRAPHQL API service relies on Graphql-spring-boot software modules, to achieve a combination of spring Boot's GRAPHQL service.
Rely on Graphql-java-tools software module, implement dynamic binding resolver method to Graphqlschema object.
Frontend, GRAPHQL query implemented using REACT Apollo
2. Back-End Code analysis
Structure is very clear layered design: Spring Boot Portal Application package, Org.springframework.samples.petclinic Pojo data class, Org.springframework.samples.petclinic.model Request parsing resolvers class, Org.springframework.samples.petclinic.graphql.resolvers data access interface, Org.springframework.samples.petclinic.repository Data access implementation class (using SPRING-DATA-JPA to access the HSQLDB database by default), ORG.SPRINGFRAMEWORK.SAMPLES.PETCLINIC.REPOSITORY.SPRINGDATAJPA 3. Backend usage
git clone https://github.com/spring-petclinic/spring-petclinic-graphql.git
CD Spring-petclinic-graphql/backend
MVNW Spring-boot:run
Since the front-end Apollo has not been studied, only the GRAPHIQL test can be accessed through the browser, and access to the http://localhost:9977/is available.
Here are two contributions from bloggers to the project.
Reference Links:
Https://github.com/spring-petclinic/spring-petclinic-graphql