Skip to content

Commit

Permalink
Merge pull request #6 from shah-smit/master
Browse files Browse the repository at this point in the history
Updated Versions in POM
  • Loading branch information
MovingToWeb authored Jun 13, 2020
2 parents a203cd1 + ff8e3d1 commit f7fc933
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
# Spring Boot with GraphQL Query Example

Update: Upgraded to Java 11 and Graph QL to 5+ version dependency

## Book Store
- `/rest/books` is the REST resource which can fetch Books information
- DataFetchers are Interfaces for RuntimeWiring of GraphQL with JpaRepository

## Sample GraphQL Scalar Queries
- Accessible under `http://localhost:8091/rest/books`
- Usage for `allBooks`
`{
```
{
allBooks {
isn
title
authors
publisher
}
}`
}
```
- Usage for `book`
`{
```
{
book(id: "123") {
title
authors
publisher
}`
}
```
- Combination of both `allBooks` and `book`
`{
```
{
allBooks {
title
authors
Expand All @@ -33,4 +40,5 @@
authors
publisher
}
}`
}
```
16 changes: 12 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<version>2.3.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<java.version>11</java.version>
</properties>

<dependencies>
Expand All @@ -45,15 +45,23 @@
<optional>true</optional>
</dependency>

<!-- https://mvnrepository.com/artifact/com.graphql-java/graphql-spring-boot-starter -->
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>3.6.0</version>
<version>5.0.2</version>
</dependency>

<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-tools</artifactId>
<version>3.2.0</version>
<version>5.2.4</version>
</dependency>

<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import javax.persistence.Id;
import javax.persistence.Table;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@Setter
@Getter
@Table
@Entity
public class Book {
Expand All @@ -23,4 +23,5 @@ public class Book {
private String publisher;
private String[] authors;
private String publishedDate;

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public Book get(DataFetchingEnvironment dataFetchingEnvironment) {

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

return bookRepository.findOne(isn);
return bookRepository.findById(isn).get();
}
}

0 comments on commit f7fc933

Please sign in to comment.