SpringWebFlux supports annotation-based controllers. This is in line with SpringMVC. There are two annotations used to create controllers:
- @Controller: The annotation defines a generic web component. Given a request, it creates a model object and generates a dynamic view response for it.
- @RestController: The annotation defines a RESTful web service. Given a request, it returns a response as JSON or XML. This is unlike the generic controller, which is capable of generating a dynamic web page for a request.
Each of the controllers serves a request pattern. The following are annotations that can be used to define the request patterns served by a controller:
- @RequestMapping: This annotation is used to mark a controller. ...