A GraphQL Java Cheat Sheet to help you understand what is what in GraphQL Java world. You might find it useful if you:
- Want to learn GraphQL Java
- Feel confused by all the Java GraphQL libraries
- Want to try GraphQL Java in your project, but not sure how to start
Gradle or Maven?
Gradle and Maven are the most popular build automation tools.
Which one you should choose? I can not provide you an answer to that question as this decision is to a large extent up to you and it depends on variables like your project's size or how much customization it needs. The tools like Spring and the constantly increasing amount of integration make it's quite a personal decision. As both approaches have their strengths and weaknesses, I hope this short summary can help you choose the right one for your project.
Gradle | Maven | |
---|---|---|
builds approach | based on a graph of task dependencies | based on a fixed and linear model of phases |
dynamic and transitive dependencies | yes | yes |
artifact repositories | JCenter | Maven Central |
private company repository | yes | yes |
custom rules, resolving version conflicts | yes | no |
advance task orderings | yes | no |
administering build infrastructure | uses wrappers that accept auto provisioning | require an extension to support self-provisioning builds |
To sum up, Gradle is much more powerful than Maven, but in many cases, you won't need to use its fancy features. If you are working on a small project you should consider Maven, if it's a big enterprise application Gradle seems to be the right choice. In the end, it's your personal choice.
Libraries
There are a couple of GraphQL Java related libraries. The only library that is strictly required is a graphql-java
which is the GraphQL implementation itself, but there are many others that you might find useful:
graphql-java: The alpha and omega of any project, the GraphQL Java implementation itself.
graphql-java-tools: The library that allows you to use the GraphQL schema language to build your GraphQL schema. It's inspired by Apollo's graphql-tools, it parses the given GraphQL schema and allows you to bring your own object to fill in the implementations.
graphql-spring-boot: A lib that contains various Spring Boot starters to enable GraphQL related services and features.
graphql-java-servlet: The implementation of GraphQL Java Servlet including support for popular libraries like Relay.js, Apollo, and OSGi out of the box; wraps the Java implementation of GraphQL provided by GraphQL Java.
graphql-java-annotations: The library that offers an annotations-based syntax for GraphQL schema definition.
DEV.TO GraphQL Java articles
- First impressions with GraphQL in Java by @committedsw
- Notes from experimenting with GraphQL and Kotlin by @baens
- Getting Started with GraphQL Java by @tomekponiat
- How to Build GraphQL Services in Java with Spring Boot by @sambenskin
Tutorials and other resources
- Gradel Tutorials and Guides
- Maven in 5 Minutes
- How to get your GraphQL Java server up and running in no time
- graphql-java Tutorial
- Migratiing Builds From Apache Maven
Video tutorials:
Spring Boot with GraphQL Query Example - Tech Primers
Building a GraphQL Server with Kotlin and graphql-java - Michael Hunger
Developing and maintaining a Java GraphQL back-end - Bojan Tomic
Top comments (1)
This looks like a great GraphQL overview for us Java and JVM folks. Thank you!