Commit f7959bcd authored by Stephane Nicoll's avatar Stephane Nicoll

Merge branch '2.1.x'

Closes gh-18567
parents f6901a50 e05c4898
......@@ -1970,17 +1970,17 @@ The following code shows a typical `@RestController` that serves JSON data:
@RequestMapping(value="/users")
public class MyRestController {
@RequestMapping(value="/\{user}", method=RequestMethod.GET)
@RequestMapping(value="/{user}", method=RequestMethod.GET)
public User getUser(@PathVariable Long user) {
// ...
}
@RequestMapping(value="/\{user}/customers", method=RequestMethod.GET)
@RequestMapping(value="/{user}/customers", method=RequestMethod.GET)
List<Customer> getUserCustomers(@PathVariable Long user) {
// ...
}
@RequestMapping(value="/\{user}", method=RequestMethod.DELETE)
@RequestMapping(value="/{user}", method=RequestMethod.DELETE)
public User deleteUser(@PathVariable Long user) {
// ...
}
......@@ -2452,17 +2452,17 @@ The annotation-based one is quite close to the Spring MVC model, as shown in the
@RequestMapping("/users")
public class MyRestController {
@GetMapping("/\{user}")
@GetMapping("/{user}")
public Mono<User> getUser(@PathVariable Long user) {
// ...
}
@GetMapping("/\{user}/customers")
@GetMapping("/{user}/customers")
public Flux<Customer> getUserCustomers(@PathVariable Long user) {
// ...
}
@DeleteMapping("/\{user}")
@DeleteMapping("/{user}")
public Mono<User> deleteUser(@PathVariable Long user) {
// ...
}
......@@ -2479,9 +2479,9 @@ The annotation-based one is quite close to the Spring MVC model, as shown in the
@Bean
public RouterFunction<ServerResponse> monoRouterFunction(UserHandler userHandler) {
return route(GET("/\{user}").and(accept(APPLICATION_JSON)), userHandler::getUser)
.andRoute(GET("/\{user}/customers").and(accept(APPLICATION_JSON)), userHandler::getUserCustomers)
.andRoute(DELETE("/\{user}").and(accept(APPLICATION_JSON)), userHandler::deleteUser);
return route(GET("/{user}").and(accept(APPLICATION_JSON)), userHandler::getUser)
.andRoute(GET("/{user}/customers").and(accept(APPLICATION_JSON)), userHandler::getUserCustomers)
.andRoute(DELETE("/{user}").and(accept(APPLICATION_JSON)), userHandler::deleteUser);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment