Log in to GraphQL EditorGet started
GraphQL Java Cheat Sheet

Tomek Poniatowicz

4/8/2019

GraphQL Java Cheat Sheet

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.

GradleMaven
builds approachbased on a graph of task dependenciesbased on a fixed and linear model of phases
dynamic and transitive dependenciesyesyes
artifact repositoriesJCenterMaven Central
private company repositoryyesyes
custom rules, resolving version conflictsyesno
advance task orderingsyesno
administering build infrastructureuses wrappers that accept auto provisioningrequire 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

Tutorials and other resources

Video tutorials:

Spring Boot with GraphQL Query Example - Tech Primers

https://www.youtube.com/watch?v=zX2I7-aIldE

Building a GraphQL Server with Kotlin and graphql-java - Michael Hunger

https://www.youtube.com/watch?v=3-yyEaQfm9c

Developing and maintaining a Java GraphQL back-end - Bojan Tomic

https://www.youtube.com/watch?v=1zIHHi2MaQE

Check out our other blogposts

Unlocking the Power of React 19
Tomasz Gajda
Tomasz Gajda
Unlocking the Power of React 19
1 min read
about 1 month ago
Zeus update - GraphQL spread operator
Michał Tyszkiewicz
Michał Tyszkiewicz
Zeus update - GraphQL spread operator
1 min read
3 months ago
What is GraphQL Zeus?
Michał Tyszkiewicz
Michał Tyszkiewicz
What is GraphQL Zeus?
1 min read
3 months ago

Ready for take-off?

Elevate your work with our editor that combines world-class visual graph, documentation and API console

Get Started with GraphQL Editor