Skip to content

Commit 02dfd68

Browse files
author
paul.oconnell
committed
Add graphql module.
1 parent 05b0013 commit 02dfd68

3 files changed

Lines changed: 44 additions & 0 deletions

File tree

β€Žgraphql/pom.xmlβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
<artifactId>spring-boot-starter-web</artifactId>
3131
</dependency>
3232

33+
<dependency>
34+
<groupId>com.graphql-java</groupId>
35+
<artifactId>graphql-java</artifactId>
36+
<version>3.0.0</version>
37+
</dependency>
38+
3339
<dependency>
3440
<groupId>org.springframework.boot</groupId>
3541
<artifactId>spring-boot-starter-test</artifactId>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package ie.emeraldjava.graphql;
2+
3+
import graphql.GraphQL;
4+
import graphql.schema.GraphQLObjectType;
5+
import graphql.schema.GraphQLSchema;
6+
7+
import static graphql.Scalars.GraphQLString;
8+
import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
9+
import static graphql.schema.GraphQLObjectType.newObject;
10+
11+
import java.util.Map;
12+
13+
/**
14+
* Created by pauloconnell on 23/05/17.
15+
*/
16+
public class Hi {
17+
18+
public static void main(String[] args) {
19+
GraphQLObjectType queryType = newObject()
20+
.name("helloWorldQuery")
21+
.field(newFieldDefinition()
22+
.type(GraphQLString)
23+
.name("hello")
24+
.staticValue("world"))
25+
.build();
26+
27+
GraphQLSchema schema = GraphQLSchema.newSchema()
28+
.query(queryType)
29+
.build();
30+
31+
GraphQL graphQL = GraphQL.newGraphQL(schema).build();
32+
33+
Map<String, Object> result = graphQL.execute("{hello}").getData();
34+
System.out.println(result);
35+
// Prints: {hello=world}
36+
}
37+
}

β€Žpom.xmlβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<module>rest-auth</module>
1515
<module>thymeleaf</module>
1616
<module>graphql</module>
17+
<module>apache-poi-racemaster</module>
1718
</modules>
1819

1920
</project>

0 commit comments

Comments
 (0)