Skip to content

Update HelloWorld GraphQL Java example and add tutorial links #1383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ url: https://github.com/graphql-java/graphql-java
github: graphql-java/graphql-java
---

See the [Getting Started tutorial](https://www.graphql-java.com/tutorials/getting-started-with-spring-boot) on the GraphQL Java website.

Code that executes a hello world GraphQL query with `graphql-java`:

```java
Expand All @@ -22,12 +24,12 @@ import static graphql.schema.idl.RuntimeWiring.newRuntimeWiring;
public class HelloWorld {

public static void main(String[] args) {
String schema = "type Query{hello: String} schema{query: Query}";
String schema = "type Query{hello: String}";

SchemaParser schemaParser = new SchemaParser();
TypeDefinitionRegistry typeDefinitionRegistry = schemaParser.parse(schema);

RuntimeWiring runtimeWiring = new RuntimeWiring()
RuntimeWiring runtimeWiring = newRuntimeWiring()
.type("Query", builder -> builder.dataFetcher("hello", new StaticDataFetcher("world")))
.build();

Expand All @@ -43,5 +45,4 @@ public class HelloWorld {
}
```

See [the graphql-java docs](https://github.com/graphql-java/graphql-java) for more information on setup.

See [the graphql-java docs](https://www.graphql-java.com/documentation/master/getting-started) for further information.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ url: https://spring.io/projects/spring-graphql
github: spring-projects/spring-graphql
---
Spring for GraphQL provides support for Spring applications built on
[GraphQL Java](https://www.graphql-java.com/).
[GraphQL Java](https://www.graphql-java.com/). See the official [Spring guide](https://spring.io/guides/gs/graphql-server/) for how to build a GraphQL service in 15 minutes.

* It is a joint collaboration between the GraphQL Java team and Spring engineering.
* Our shared philosophy is to provide as little opinion as we can while focusing on comprehensive support for a wide range of use cases.
Expand Down