GraphQL with Java and Spring Boot (Spring for GraphQL):
- queries (
getUserById,getAllUsers) and a mutation (addNewUser) @BatchMappingto load addresses in one batch instead of one call per user (no N+1)- a subscription over WebSocket (
greetNewUsers)
Companion code for my article GraphQL with Java and Spring Boot.
Start GraphqlSpringExampleApplication, then open GraphiQL at http://localhost:8080/graphiql and try:
query { getAllUsers { userId firstName address { city } } }Spring Boot 2.7, Java 17. Data is kept in memory.