{"id":17471186,"url":"https://github.com/vladimir-dejanovic/graphql-spring-boot-example","last_synced_at":"2025-03-17T20:30:51.221Z","repository":{"id":123190050,"uuid":"155633072","full_name":"vladimir-dejanovic/graphql-spring-boot-example","owner":"vladimir-dejanovic","description":"graphql-spring-boot-example","archived":false,"fork":false,"pushed_at":"2018-11-08T22:21:08.000Z","size":24,"stargazers_count":5,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T03:41:55.268Z","etag":null,"topics":["graphql","graphql-server","java","spring-boot"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vladimir-dejanovic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-31T22:51:22.000Z","updated_at":"2022-09-22T20:42:44.000Z","dependencies_parsed_at":"2023-03-28T20:02:21.077Z","dependency_job_id":null,"html_url":"https://github.com/vladimir-dejanovic/graphql-spring-boot-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladimir-dejanovic%2Fgraphql-spring-boot-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladimir-dejanovic%2Fgraphql-spring-boot-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladimir-dejanovic%2Fgraphql-spring-boot-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladimir-dejanovic%2Fgraphql-spring-boot-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vladimir-dejanovic","download_url":"https://codeload.github.com/vladimir-dejanovic/graphql-spring-boot-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243878490,"owners_count":20362433,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","graphql-server","java","spring-boot"],"created_at":"2024-10-18T16:29:33.858Z","updated_at":"2025-03-17T20:30:51.216Z","avatar_url":"https://github.com/vladimir-dejanovic.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraphQL example implemented with Spring Boot\n\nThis is simple example of GraphQL API implemented in Java with Spring Boot, and relaying on it's magic :)\n\nThere is example of implementation of **Query** and **Subscription**.\n\n## Dependencies\n\n### GraphQL\n\nFor GraphQL dependency added \n\n```\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.graphql-java\u003c/groupId\u003e\n            \u003cartifactId\u003egraphql-java\u003c/artifactId\u003e\n            \u003cversion\u003e8.0\u003c/version\u003e\n        \u003c/dependency\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.graphql-java\u003c/groupId\u003e\n            \u003cartifactId\u003egraphql-java-tools\u003c/artifactId\u003e\n            \u003cversion\u003e5.0.0\u003c/version\u003e\n        \u003c/dependency\u003e\n```\n\n### GraphQL Spring Boot integration\n\nTo connect GraphQL and Spring Boot added this dependency\n\n```\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.graphql-java\u003c/groupId\u003e\n            \u003cartifactId\u003egraphql-spring-boot-starter\u003c/artifactId\u003e\n            \u003cversion\u003e5.0.2\u003c/version\u003e\n        \u003c/dependency\u003e\n```\n\n### GraphiQL \"out of the box\"\n\nIn order to get GraqhiQL, UI for testing local version of GraphQL API added this dependency\n\n```\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.graphql-java\u003c/groupId\u003e\n            \u003cartifactId\u003egraphiql-spring-boot-starter\u003c/artifactId\u003e\n            \u003cversion\u003e5.0.2\u003c/version\u003e\n        \u003c/dependency\u003e\n\n```\n\nFor GraphiQL hit http://localhost:8080/graphiql, when you start application\n\n\n## Query implementation\n\nQuery implementation is almost exactly the same like all other my examples of Query. Only difference is annotation **@Component** at top.\nFor full code just open  [Query.java](https://github.com/vladimir-dejanovic/graphql-spring-boot-example/blob/master/src/main/java/xyz/itshark/play/graphqlspringboot/example/resolves/Query.java)\n\nQuery example in GraphiQL \n```\nquery {\n  allData {\n    message\n  }\n}\n```\n\n## Mutation implementation\n\nMutation implementation is almost exactly the same like all other my examples of Mutation. Only difference is annotation **@Component** at top.\nFor full code just open  [Mutation.java](https://github.com/vladimir-dejanovic/graphql-spring-boot-example/blob/master/src/main/java/xyz/itshark/play/graphqlspringboot/example/resolves/Mutation.java)\n\nMutation example in GraphiQL\n```\nmutation {\n  add(message:\"Hello\") {\n    message\n  }\n}\n```\n\nafter mutation you can run query again and check if all worked as intended.\n\n## Subscription implementation\n\nSubscription implementation is done using RXJava and by implementing **GraphQLSubscriptionResolver**\n\nFor full code example check  [Subscription.java](https://github.com/vladimir-dejanovic/graphql-spring-boot-example/blob/master/src/main/java/xyz/itshark/play/graphqlspringboot/example/resolves/Subscription.java)\n \nSubscription **can be** tested from GraphiQL.\n\nSubscription example in GraphiQL\n```\nsubscription {\n  data {\n    message\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladimir-dejanovic%2Fgraphql-spring-boot-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvladimir-dejanovic%2Fgraphql-spring-boot-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladimir-dejanovic%2Fgraphql-spring-boot-example/lists"}