PROJECT MOVED TO https://github.com/stojsavljevic/spring-graphql-examples
This project demonstrates 3 different Spring implementations of GraphQL protocol: Netflix DGS, Java Kickstart and Spring for GraphQL. Every implementation is in its own module and they all share the same GraphQL schema and fetch data using common class. Security configuration is also the same. Every module is covered with integration tests.
It also has two Apollo React clients that uses different WebSocket implementations.
graphql-corelibrary with common code and resourcesgraphql-dgsNetflix DGS modulegraphql-kickstartJava Kickstart module - DEPRECATEDgraphql-springSpring for GraphQL module
- Every module uses form login:
admin/admin. - In order to disable security start components with
no-securityspring profile. - WebSocket authentication can be done in two ways:
- using session cookies when client is embedded in a page
- using
authTokenin connection payload that simulates Bearer token authentication. This is demonstrated in Apollo React clients. Note that DGS implementation doesn't support it.
- Every component starts on
8080port by default. - Every component exposes Apollo React client on http://localhost:8080/apollo/index.html. Note that DGS and Spring implementations shares the same Apollo client in
graphql-coremodule. That client uses new WebSocket protocol. Kickstart has its own Apollo client that uses deprecated protocol.
query {
allPosts {
title
content
releaseYear
author {
name
}
}
}
subscription {
randomPost {
title
content
releaseYear
author {
name
}
}
}
mutation {
createPost(postInput: {
title: "The Shining"
content: "I believe that children are our future. Unless we stop them now."
authorId: 1
}) {
title
content
releaseYear
author {
name
}
}
}