GraphQL on Spring Boot
REST vs. GraphQL
REST:
- returns all of data points as designed by developer whether or not you need it.
GraphQL:
- is flexible in return response
- is a query language for API
- is used to load data from a server to a client
- enables client can specify when it needs
- allows to provide aggregated data from multi data source with one call.
Packages
graphql-spring-boot-starter - This starter is very helpful because it will add and automatically configure a GraphQL Servlet that you can access at /graphql . This starter will also use a GraphQL schema library to parse all schema files found on the classpath. The starter will also set up an endpoint that can access POST requests.
graphql-java-tools - A helper library to parse the GraphQL schema.
source: