What's the difference in using ModelAndView and ResponseEntity?

2

I came across these two classes, I found their function well the same. What are the differences between them and when is the time to use a specific one?

    
asked by anonymous 17.01.2018 / 18:28

2 answers

3

ResponseEntity: means to represent the entire HTTP response. You can control anything that happens: status code, headers, and body.

  

Working with microservice, ResponseEntity to send response   complete, with status, with header and body.

ModelAndView : This class is used to specify the view that will be rendered and what data it will use for that.

  

ModelAndView default MVC.

I hope I have helped

    
17.01.2018 / 18:53
0

On the usability issue, ResponseEntity is heavily used in service-oriented architectures (SOA), specifically in building APIs #, as response element (response, hence the name) for the call of a given service.

    
17.01.2018 / 19:47