@RestController not intended to return allowed permissions. It is supposed to return the data that will be written to the response body, therefore, the inclusion of @ResponseBody . You cannot selectively disable @ResponseBody for individual handler methods when @ResponseBody already a class level annotation.
You can get around it by returning a ModelAndView that will work even in @RestController , but you really shouldn't:
@RequestMapping public ModelAndView renderFooList() { ModelAndView mav = new ModelAndView("foo/list"); mav.addObject("foos", fooService.getFoos()); return mav; }
It would be better to create separate controllers for regular handlers that return views and REST controllers for RESTful stuff. Or, comment on the class with a simple @Controller and put @ResponseBody in the methods you really need.
source share