@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); }
@RequestMapping(method = RequestMethod.GET) public Page<Guru> listGuru(Pageable pageable) { return guruRepository.findAll(pageable); }