Skip to content

Commit f7fc933

Browse files
authored
Merge pull request #6 from shah-smit/master
Updated Versions in POM
2 parents a203cd1 + ff8e3d1 commit f7fc933

File tree

4 files changed

+30
-13
lines changed

4 files changed

+30
-13
lines changed

Diff for: README.md

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
11
# Spring Boot with GraphQL Query Example
22

3+
Update: Upgraded to Java 11 and Graph QL to 5+ version dependency
4+
35
## Book Store
46
- `/rest/books` is the REST resource which can fetch Books information
57
- DataFetchers are Interfaces for RuntimeWiring of GraphQL with JpaRepository
68

79
## Sample GraphQL Scalar Queries
810
- Accessible under `http://localhost:8091/rest/books`
911
- Usage for `allBooks`
10-
`{
12+
```
13+
{
1114
allBooks {
1215
isn
1316
title
1417
authors
1518
publisher
1619
}
17-
}`
20+
}
21+
```
1822
- Usage for `book`
19-
`{
23+
```
24+
{
2025
book(id: "123") {
2126
title
2227
authors
2328
publisher
24-
}`
29+
}
30+
```
2531
- Combination of both `allBooks` and `book`
26-
`{
32+
```
33+
{
2734
allBooks {
2835
title
2936
authors
@@ -33,4 +40,5 @@
3340
authors
3441
publisher
3542
}
36-
}`
43+
}
44+
```

Diff for: pom.xml

+12-4
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
<parent>
1515
<groupId>org.springframework.boot</groupId>
1616
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>1.5.9.RELEASE</version>
17+
<version>2.3.0.RELEASE</version>
1818
<relativePath/> <!-- lookup parent from repository -->
1919
</parent>
2020

2121
<properties>
2222
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2323
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24-
<java.version>1.8</java.version>
24+
<java.version>11</java.version>
2525
</properties>
2626

2727
<dependencies>
@@ -45,15 +45,23 @@
4545
<optional>true</optional>
4646
</dependency>
4747

48+
<!-- https://mvnrepository.com/artifact/com.graphql-java/graphql-spring-boot-starter -->
4849
<dependency>
4950
<groupId>com.graphql-java</groupId>
5051
<artifactId>graphql-spring-boot-starter</artifactId>
51-
<version>3.6.0</version>
52+
<version>5.0.2</version>
5253
</dependency>
54+
5355
<dependency>
5456
<groupId>com.graphql-java</groupId>
5557
<artifactId>graphql-java-tools</artifactId>
56-
<version>3.2.0</version>
58+
<version>5.2.4</version>
59+
</dependency>
60+
61+
<dependency>
62+
<groupId>javax.xml.bind</groupId>
63+
<artifactId>jaxb-api</artifactId>
64+
<version>2.3.0</version>
5765
</dependency>
5866

5967
<dependency>

Diff for: src/main/java/com/techprimers/graphql/springbootgrapqlexample/model/Book.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
import javax.persistence.Id;
1010
import javax.persistence.Table;
1111

12-
@Setter
13-
@Getter
1412
@AllArgsConstructor
1513
@NoArgsConstructor
14+
@Setter
15+
@Getter
1616
@Table
1717
@Entity
1818
public class Book {
@@ -23,4 +23,5 @@ public class Book {
2323
private String publisher;
2424
private String[] authors;
2525
private String publishedDate;
26+
2627
}

Diff for: src/main/java/com/techprimers/graphql/springbootgrapqlexample/service/datafetcher/BookDataFetcher.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ public Book get(DataFetchingEnvironment dataFetchingEnvironment) {
1818

1919
String isn = dataFetchingEnvironment.getArgument("id");
2020

21-
return bookRepository.findOne(isn);
21+
return bookRepository.findById(isn).get();
2222
}
2323
}

0 commit comments

Comments
 (0)