コード例 #1
0
 @RequestMapping(
     value = "/search",
     method = RequestMethod.GET,
     produces = "text/html;charset=UTF-8")
 public @ResponseBody String search() throws Exception {
   List<Farmer> farmers = farmerRepository.findAll();
   String resultArrayJson = mapper.writeValueAsString(farmers);
   log.debug(format("resultArrayJson: %s", resultArrayJson));
   return resultArrayJson;
 }
コード例 #2
0
 @RequestMapping(value = "/create", method = RequestMethod.GET)
 @ResponseStatus(value = HttpStatus.OK)
 public void create() {
   farmerRepository.save(new Farmer(100L, "王五", 20));
 }