diff --git a/spring-cloud/spring-cloud-connectors-heroku/pom.xml b/spring-cloud/spring-cloud-connectors-heroku/pom.xml
index 1dad3ddcb7..c09a282197 100644
--- a/spring-cloud/spring-cloud-connectors-heroku/pom.xml
+++ b/spring-cloud/spring-cloud-connectors-heroku/pom.xml
@@ -9,9 +9,9 @@
com.baeldung
- parent-boot-1
+ parent-boot-2
0.0.1-SNAPSHOT
- ../../parent-boot-1
+ ../../parent-boot-2
@@ -35,6 +35,11 @@
org.postgresql
postgresql
+
+ net.bytebuddy
+ byte-buddy-dep
+ ${bytebuddy.version}
+
com.h2database
h2
@@ -55,8 +60,9 @@
- Brixton.SR7
- 9.4-1201-jdbc4
+ Hoxton.SR4
+ 42.2.10
+ 1.10.10
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/book/BookController.java b/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/book/BookController.java
index eb2972f35a..f998059028 100644
--- a/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/book/BookController.java
+++ b/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/book/BookController.java
@@ -1,5 +1,7 @@
package com.baeldung.spring.cloud.connectors.heroku.book;
+import java.util.Optional;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -15,7 +17,7 @@ public class BookController {
}
@GetMapping("/{bookId}")
- public Book findBook(@PathVariable Long bookId) {
+ public Optional findBook(@PathVariable Long bookId) {
return bookService.findBookById(bookId);
}
diff --git a/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/book/BookService.java b/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/book/BookService.java
index 4978ded65f..a83dfe64b7 100644
--- a/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/book/BookService.java
+++ b/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/book/BookService.java
@@ -1,5 +1,7 @@
package com.baeldung.spring.cloud.connectors.heroku.book;
+import java.util.Optional;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@@ -15,8 +17,8 @@ public class BookService {
this.bookRepository = bookRepository;
}
- public Book findBookById(Long bookId) {
- return bookRepository.findOne(bookId);
+ public Optional findBookById(Long bookId) {
+ return bookRepository.findById(bookId);
}
@Transactional(propagation = Propagation.REQUIRED)
diff --git a/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/product/ProductController.java b/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/product/ProductController.java
index 51cf4412bf..7875c712f9 100644
--- a/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/product/ProductController.java
+++ b/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/product/ProductController.java
@@ -1,5 +1,7 @@
package com.baeldung.spring.cloud.connectors.heroku.product;
+import java.util.Optional;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -15,7 +17,7 @@ public class ProductController {
}
@GetMapping("/{productId}")
- public Product findProduct(@PathVariable Long productId) {
+ public Optional findProduct(@PathVariable Long productId) {
return productService.findProductById(productId);
}
diff --git a/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/product/ProductService.java b/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/product/ProductService.java
index f25b4ecf7b..bdd13e9863 100644
--- a/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/product/ProductService.java
+++ b/spring-cloud/spring-cloud-connectors-heroku/src/main/java/com/baeldung/spring/cloud/connectors/heroku/product/ProductService.java
@@ -1,5 +1,7 @@
package com.baeldung.spring.cloud.connectors.heroku.product;
+import java.util.Optional;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@@ -15,8 +17,8 @@ public class ProductService {
this.productRepository = productRepository;
}
- public Product findProductById(Long productId) {
- return productRepository.findOne(productId);
+ public Optional findProductById(Long productId) {
+ return productRepository.findById(productId);
}
@Transactional(propagation = Propagation.REQUIRED)