Share this
Twitter Shield
← Back to blog

GraphQL Java Cheat Sheet

April 08, 2019

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

Tutorials and other resources

Video tutorials:

Spring Boot with GraphQL Query Example - Tech Primers vid1

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

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

Hey, have a minute?

Do you want to try our mock backend from GraphQL app. It is in beta phase and 100% free.

Try visual editor app

Tomek Poniatowicz
Written by Tomek Poniatowicz Marketing. Growth Hacking. Magic the Gathering fanatic. Pizza Lover email me:[email protected]Twitter Shield
← Back to blog