we have recently started migrating our web application from spring to spring boot 2.4.5. In spring we were able to send ModelAndView as a result from spring controller in Ajax call from UI, but after migrating to spring boot 2.4.5 we are not able to return ModelAndView in ajax call, getting 404 HTTP error.
Can anyone please help me with this, I have missed something during migration?
Thanks
sample code, which was working fine with spring but breaking in spring boot:
public ModelAndView saveData(HttpServletRequest request, @RequestParam final Map<String, String> map) {
ModalAndView mav = new ModelAndView();
modelAndView.addObject("status"), "IS_WORKING");
return mav;
}
If i update the above code with below, then the ajax call is working fine witn spring boot:
public @ResponseBody ModelMap saveData(HttpServletRequest request, @RequestParam final Map<String, String> map)
{
ModelMap modelMap = new ModelMap();
modelMap .addAttribute("status"), "IS_WORKING");
return modelMap ;
}