Skip to content

Commit ef92762

Browse files
committed
Merge pull request #30027 from wonwoo
* gh-30027: Polish RestController examples Closes gh-30027
2 parents 57f935f + c2bf0d5 commit ef92762

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springmvc/MyRestController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ public MyRestController(UserRepository userRepository, CustomerRepository custom
3737
this.customerRepository = customerRepository;
3838
}
3939

40-
@GetMapping("/{user}")
40+
@GetMapping("/{userId}")
4141
public User getUser(@PathVariable Long userId) {
4242
return this.userRepository.findById(userId).get();
4343
}
4444

45-
@GetMapping("/{user}/customers")
45+
@GetMapping("/{userId}/customers")
4646
public List<Customer> getUserCustomers(@PathVariable Long userId) {
4747
return this.userRepository.findById(userId).map(this.customerRepository::findByUser).get();
4848
}
4949

50-
@DeleteMapping("/{user}")
50+
@DeleteMapping("/{userId}")
5151
public void deleteUser(@PathVariable Long userId) {
5252
this.userRepository.deleteById(userId);
5353
}

spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/developingwebapplications/springwebflux/MyRestController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ public MyRestController(UserRepository userRepository, CustomerRepository custom
3838
this.customerRepository = customerRepository;
3939
}
4040

41-
@GetMapping("/{user}")
41+
@GetMapping("/{userId}")
4242
public Mono<User> getUser(@PathVariable Long userId) {
4343
return this.userRepository.findById(userId);
4444
}
4545

46-
@GetMapping("/{user}/customers")
46+
@GetMapping("/{userId}/customers")
4747
public Flux<Customer> getUserCustomers(@PathVariable Long userId) {
4848
return this.userRepository.findById(userId).flatMapMany(this.customerRepository::findByUser);
4949
}
5050

51-
@DeleteMapping("/{user}")
52-
public void deleteUser(@PathVariable Long userId) {
53-
this.userRepository.deleteById(userId);
51+
@DeleteMapping("/{userId}")
52+
public Mono<Void> deleteUser(@PathVariable Long userId) {
53+
return this.userRepository.deleteById(userId);
5454
}
5555

5656
}

0 commit comments

Comments
 (0)