Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Any webservice which supports GraphQL is consumable through a Java implementation? Because "it provides an alternative to REST..."?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
637 views
Welcome To Ask or Share your Answers For Others

1 Answer

Graphql-java (that you linked to) is an implementation of the GraphQL specification. As such, it is used to create GraphQL servers. A client doesn't need anything special to consume a service, just like it doesn't need anything special to consume a REST service - only to be be able to speak HTTP. You can use any generic HTTP client you like.

Still, you have some more convenient options for creating clients (but both somewhat lacking):

  1. Apollo Android - Don't let the name fool you, it's perfectly usable from normal Java. Not the most ergonomic solution, but it works.
  2. Shopify's Graphql Java Generator - Unfortunately, requires Ruby to build (not to run, of course). Generates Java classes for creating queries in a type-safe way, similar to what wsdl2java Maven plugin does for SOAP services.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...