0 votes
in Spring by
What are the uses of @RequestMapping and @RestController annotations in Spring Boot?

1 Answer

0 votes
by

@RequestMapping:

This provides the routing information and informs Spring that any HTTP request matching the URL must be mapped to the respective method.

org.springframework.web.bind.annotation.RequestMapping has to be imported to use this annotation.

@RestController:

This is applied to a class to mark it as a request handler thereby creating RESTful web services using Spring MVC. This annotation adds the @ResponseBody and @Controller annotation to the class.

org.springframework.web.bind.annotation.RestController has to be imported to use this annotation.

Related questions

0 votes
asked Apr 4, 2021 in Spring by Robindeniel
0 votes
asked Apr 4, 2021 in Spring by Robindeniel
...