/** This method is secured in config */ @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) public Person create(@RequestBody final Person person) { return personRepository.saveAndFlush(person); }
/** This method is secured with annotation */ @PreAuthorize("#oauth2.hasScope('write') and hasRole('ROLE_KILLER')") @ResponseStatus(HttpStatus.OK) @RequestMapping(method = RequestMethod.DELETE, value = "/{personId}") public void delete(@PathVariable final Long personId) { personRepository.delete(personId); }
@RequestMapping public List<Person> findAll() { return personRepository.findAll(); }