diff --git a/src/main/java/com/example/springtest/demo/resources/UserRest.java b/src/main/java/com/example/springtest/demo/resources/UserRest.java index 3f9ad5c..06f136e 100644 --- a/src/main/java/com/example/springtest/demo/resources/UserRest.java +++ b/src/main/java/com/example/springtest/demo/resources/UserRest.java @@ -45,7 +45,7 @@ public Optional getUser(@PathParam("uId") String uId) { Optional user = userRepository.findById(uId); // User user = users.get(uId); - if (user != null) { + if (user.isPresent()) { return user; // JSONが返る } else { // uIdが無ければ throw new WebApplicationException(404); // 404が返る