@RequestMapping(value = "") public ModelAndView index() { List<User> users = userService.getAllUsers(); ModelAndView modelView = new ModelAndView("users/index"); modelView.addObject("users", users); return modelView; }
@RequestMapping(method = RequestMethod.GET, produces = "application/json") public @ResponseBody ResponseEntity index() { List<User> users = userService.getAllUsers(); return new ResponseEntity<List<User>>(users, HttpStatus.OK); }