From c2bf0d551b642628267d4b8ee2bc3023330ededb Mon Sep 17 00:00:00 2001 From: wonwoo Date: Wed, 2 Mar 2022 14:27:19 +0900 Subject: [PATCH] Polish RestController examples See gh-30027 --- .../springmvc/MyRestController.java | 6 +++--- .../springwebflux/MyRestController.java | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springmvc/MyRestController.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springmvc/MyRestController.java index d139042e7f..fbe815ef39 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springmvc/MyRestController.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springmvc/MyRestController.java @@ -37,17 +37,17 @@ public class MyRestController { this.customerRepository = customerRepository; } - @GetMapping("/{user}") + @GetMapping("/{userId}") public User getUser(@PathVariable Long userId) { return this.userRepository.findById(userId).get(); } - @GetMapping("/{user}/customers") + @GetMapping("/{userId}/customers") public List getUserCustomers(@PathVariable Long userId) { return this.userRepository.findById(userId).map(this.customerRepository::findByUser).get(); } - @DeleteMapping("/{user}") + @DeleteMapping("/{userId}") public void deleteUser(@PathVariable Long userId) { this.userRepository.deleteById(userId); } diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springwebflux/MyRestController.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springwebflux/MyRestController.java index d9c5c9a0f9..0aa35f2dbc 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springwebflux/MyRestController.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springwebflux/MyRestController.java @@ -38,19 +38,19 @@ public class MyRestController { this.customerRepository = customerRepository; } - @GetMapping("/{user}") + @GetMapping("/{userId}") public Mono getUser(@PathVariable Long userId) { return this.userRepository.findById(userId); } - @GetMapping("/{user}/customers") + @GetMapping("/{userId}/customers") public Flux getUserCustomers(@PathVariable Long userId) { return this.userRepository.findById(userId).flatMapMany(this.customerRepository::findByUser); } - @DeleteMapping("/{user}") - public void deleteUser(@PathVariable Long userId) { - this.userRepository.deleteById(userId); + @DeleteMapping("/{userId}") + public Mono deleteUser(@PathVariable Long userId) { + return this.userRepository.deleteById(userId); } }