Search code examples
javaclientgraphql

GraphQL Java client library


I am looking for a java client library for GraphQL. This is to use for server-to-server communication, both in java. No android, not javascript... just java. Apollo is the nearest answer, and it seems like it is for Android only, not for plain-java applications. Lots of examples about build server in java, nothing about client. Any idea? Thanks!


Solution

  • There's a few clients available, all taking different approaches.

    1. Apollo Android - Originally intended for Android, but equally usable in any Java project. Someone also made a Maven plugin for it.
    2. Shopify's GraphQL Java gen - Similar to what wsdl2java does, for example, but not wrapped into a Maven plugin. Generates a nice client, but requires Ruby... It's worth investigating if the Ruby dependency can be satisfied using JRuby JAR.
    3. Nodes A GraphQL JVM Client designed for constructing queries from standard model definitions. By American Express
    4. Manifold can be used as a GraphQL client
    5. graphql-kotlin GraphQL Kotlin provides a set of lightweight type-safe GraphQL HTTP clients. The library provides Ktor HTTP client and Spring WebClient based reference implementations as well as allows for custom implementations using other engines. Type-safe data models are generated at build time by the GraphQL Kotlin Gradle and Maven plugins.