In this topic you'll read about annotations mainly related to Spring MVC. Some of the related annotations are as follows: @Controller
, @RequestMapping
, @RequestParam
, @RequestBody
, @ResponseBody
, @RestController
, @ModelAttribute
, @ControllerAdvice
, @ExceptionHandler
, @ResponseStatus
.
Of course there're more annotations which are extremly important as well but not belong directly to Spring MVC. Such as: @Required
, @Autowired
, @Resource
, and many more.
Annotation | Explanation |
---|---|
@Controller | With @Controller annotation you mark a Java Class as a Class that holds HTTP handlers, in other words, HTTP access points to your application. |
@RequestMapping | The @RequestMapping annotation is the one that you'll use to mark HTTP handlers (HTTP access points to your application) within your @Controller Class |
@RequestParam | Use the @RequestParam annotation to bind request parameters to a method parameter in your controller. |