Configuring annotations

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. ...

Get Hands-On Reactive Programming with Reactor now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.