コード例 #1
0
 @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();
 }
コード例 #2
0
 @RequestMapping(value = "add", method = RequestMethod.POST, produces = "application/json")
 @ResponseBody
 public Category addCategory(@RequestBody Category category) {
   categoryDao.save(category);
   return category;
 }