What are the differences between PUT and POST in REST?

DWQA QuestionsCategory: Web Design HTMLWhat are the differences between PUT and POST in REST?
Editor Staff asked 1 month ago

What are the differences between the annotations @Controller and @RestController?

1 Answers
Editor Staff answered 1 month ago

@Controller 
@RestController

Mostly used traditional Spring MVC service. 
Represents RESTful web service in Spring.

It is mostly used in Spring MVC service where model data needs to rendered using view.
It is used in case of RESTful web service that returns object values bound to response body.

If response values need to be converted through HttpMessageConverters and sent via response object, extra annotation @ResponseBody needs to be used on the class or the method handlers.
The default behavior of the @RestController needs to be written on the response body because it is the combination of @Controller and @ResponseBody.

@Controller provides control and flexibility over how the response needs to be sent.
@RestController annotation has no such flexibility and writes all the results to the response body.