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-core
library with common code and resourcesgraphql-dgs
Netflix DGS modulegraphql-kickstart
Java Kickstart module - DEPRECATEDgraphql-spring
Spring for GraphQL module
- Every module uses form login:
admin/admin
. - In order to disable security start components with
no-security
spring profile. - WebSocket authentication can be done in two ways:
- using session cookies when client is embedded in a page
- using
authToken
in 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
8080
port 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-core
module. 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
}
}
}