diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/reactive/webflux/MyRestController.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/reactive/webflux/MyRestController.java index bde6ad0451..338c9e9a61 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/reactive/webflux/MyRestController.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/reactive/webflux/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); } } diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/servlet/springmvc/MyRestController.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/servlet/springmvc/MyRestController.java index 461c67fbe2..894fa6605c 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/servlet/springmvc/MyRestController.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/servlet/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/kotlin/org/springframework/boot/docs/web/reactive/webflux/MyRestController.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/MyRestController.kt index 68b154c6ac..0daffce4af 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/MyRestController.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/reactive/webflux/MyRestController.kt @@ -28,21 +28,21 @@ import reactor.core.publisher.Mono @RequestMapping("/users") class MyRestController(private val userRepository: UserRepository, private val customerRepository: CustomerRepository) { - @GetMapping("/{user}") + @GetMapping("/{userId}") fun getUser(@PathVariable userId: Long): Mono { return userRepository.findById(userId) } - @GetMapping("/{user}/customers") + @GetMapping("/{userId}/customers") fun getUserCustomers(@PathVariable userId: Long): Flux { return userRepository.findById(userId).flatMapMany { user: User? -> customerRepository.findByUser(user) } } - @DeleteMapping("/{user}") - fun deleteUser(@PathVariable userId: Long) { - userRepository.deleteById(userId) + @DeleteMapping("/{userId}") + fun deleteUser(@PathVariable userId: Long): Mono { + return userRepository.deleteById(userId) } } diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/MyRestController.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/MyRestController.kt index 3e44766f83..9dd2b13a39 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/MyRestController.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/servlet/springmvc/MyRestController.kt @@ -27,17 +27,17 @@ import org.springframework.web.bind.annotation.RestController @RequestMapping("/users") class MyRestController(private val userRepository: UserRepository, private val customerRepository: CustomerRepository) { - @GetMapping("/{user}") + @GetMapping("/{userId}") fun getUser(@PathVariable userId: Long): User { return userRepository.findById(userId).get() } - @GetMapping("/{user}/customers") + @GetMapping("/{userId}/customers") fun getUserCustomers(@PathVariable userId: Long): List { return userRepository.findById(userId).map(customerRepository::findByUser).get() } - @DeleteMapping("/{user}") + @DeleteMapping("/{userId}") fun deleteUser(@PathVariable userId: Long) { userRepository.deleteById(userId) }