コード例 #1
0
 @RequestMapping(method = RequestMethod.POST)
 public ResponseEntity<Guru> addGuru(
     @Validated @RequestBody Guru guru, BindingResult bindingResult) {
   if (bindingResult.hasErrors()) {
     return new ResponseEntity<Guru>(HttpStatus.BAD_REQUEST);
   }
   Guru newGuru = guruRepository.save(guru);
   return new ResponseEntity<Guru>(newGuru, HttpStatus.OK);
 }
コード例 #2
0
 @RequestMapping(method = RequestMethod.GET)
 public Page<Guru> listGuru(Pageable pageable) {
   return guruRepository.findAll(pageable);
 }