Difference between @Controller and RouterFunction in Spring 5 WebFlux
问题 There are two ways to expose HTTP endpoints in spring 5 now. @Controller or @RestController by making the controller's class, e.g. @RestController @RequestMapping("persons") public class PersonController { @Autowired private PersonRepo repo; @GetMapping("/{id}") public Mono<Person> personById(@PathVariable String id){ retrun repo.findById(id); } } Route in @Configuration class by using RouterFunctions: @Bean public RouterFunction<ServerResponse> personRoute(PersonRepo repo) { return route(GET