Log in to GraphQL Editor
GraphQL Java Cheat Sheet
Tomek

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

GraphQL tools & libraries - Part 3
Michał Tyszkiewicz
Michał Tyszkiewicz
GraphQL tools & libraries - Part 3
4 min read
over 3 years ago
Handling web fonts with TypoGraphy.js
Tomek Poniatowicz
Tomek Poniatowicz
Handling web fonts with TypoGraphy.js
3 min read
almost 5 years ago
What’s new in Angular 9?
Infotech
Infotech
What’s new in Angular 9?
3 min read
about 4 years 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