Spring GraphQL examples using the following frameworks and libraries:
- Netflix DGS(Domain Graph Service) framework
- Spring GraphQL
- GraphQL Java Kickstart
- GraphQL Java
- GraphQL SPQR(GraphQL Schema Publisher & Query Resolver, pronounced like speaker)
- ExpediaGroup GraphQL Kotlin
Other GraphQL Java integration examples with Java frameworks.
TBD
Example name | Description |
---|---|
dgs | Simple Netflix DGS example |
dgs-webflux | Simple Netflix DGS example with Spring WebFlux |
dgs-subscription-ws | Simple Netflix DGS Subscription example using WebSocket protocol |
dgs-subscription-ui | Angular Client app for dgs-subscription-ws |
dgs-subscription-sse | Simple Netflix DGS Subscription example using Http/SSE protocol |
dgs-codegen | Netflix DGS example with Spring Jdbc and Gradle codegen plugin |
dgs-fileupload | Netflix DGS file upload example |
dgs-client | Netflix DGS Typesafe Client example |
dgs-kotlin-co | A complete Netflix DGS example with WebFlux, Kotlin Coroutines, Spring Data R2dbc and Spring Security |
dgs-kotlin | A complete Netflix DGS example with WebMvc/Kotlin, Spring Data Jdbc, Spring Security and Spring Session/Spring Data Redis |
graphql-kotlin | ExpediaGroup Graphql Kotlin Spring Boot example |
spring-graphql | Spring GraphQL example |
spring-graphql-webmvc | Spring GraphQL with WebMvc Controller annotation example |
spring-graphql-querydsl | Spring GraphQL/JPA/QueryDSl Data Fetchers example |
spring-graphql-webflux | Spring GraphQL/WebFlux example with WebSocket transport protocol |
spring-graphql-rsocket-kotlin-co | Spring GraphQL/WebFlux/Kotlin Coroutines example with RSocket transport protocol |
Some example codes are moved to legacy folder, because the upstream project is discontinued or under an inactive development status.
Example name | Description |
---|---|
graphql-java | GraphQL Java vanilla Spring Boot example, upstream project is discontinuned, replaced by Spring GraphQL |
graphql-spqr | GraphQL SPQR Spring example, inactive |
graphql-java-kickstart | GraphQL Java Kickstart Spring Boot example |
graphql-java-kickstart-webclient | GraphQL Java Kickstart Spring WebClient example |
graphql-java-kickstart-annotations | GraphQL Java Kickstart Spring Boot example(Code first) |
Make sure you have installed the following software.
- Java 21
- Apache Maven 3.8.x / Gradle 7.x
- Docker
Some sample codes are written in Kotlin. If you are new to Kotlin, start to learn it from the the Kotlin homepage.
Clone the source codes from Github.
git clone https://github.com/hantsy/spring-graphql-sample/
Open a terminal, and switch to the root folder of the project, and run the following command to build the whole project.
docker-compose up postgres // start up a postgres it is required
cd examplename // change to the example folder
mvn clean install // build the project
//or
./gradlew build
Run the application.
mvn spring-boot:run
//or
./gradlew bootRun
// or from command line after building
java -jar target/xxx.jar
Any suggestions are welcome, filing an issue or submitting a PR is also highly recommended.
- Getting started with GraphQL Java and Spring Boot
- Getting Started with GraphQL and Spring Boot
- Open Sourcing the Netflix Domain Graph Service Framework: GraphQL for Spring Boot
- Netflix Open Sources Their Domain Graph Service Framework: GraphQL for Spring Boot
- Netflix Embraces GraphQL Microservices for Rapid Application Development
- GraphQL Reference Guide: Building Flexible and Understandable APIs