@RequestMapping(value = "all", method = RequestMethod.GET, produces = "application/json") @ResponseBody public List<Category> getAllCategories() { System.out.println("categories: "); for (Category category : categoryDao.all()) { System.out.println(category.getFoodItems().size()); } return categoryDao.all(); }
@RequestMapping(value = "add", method = RequestMethod.POST, produces = "application/json") @ResponseBody public Category addCategory(@RequestBody Category category) { categoryDao.save(category); return category; }