Skip to content

Instantly share code, notes, and snippets.

@Enigo
Last active March 1, 2021 10:43
Show Gist options
  • Save Enigo/c7e4b6e3365c84cb66cf2ab3148b6031 to your computer and use it in GitHub Desktop.
Save Enigo/c7e4b6e3365c84cb66cf2ab3148b6031 to your computer and use it in GitHub Desktop.
@RestController
@RequestMapping(path = "/zoo")
public class ZooController {
@Secured(Role.Code.ADMIN)
@PostMapping(path = "/add", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public String addAnimal(@RequestBody String payload) {
return "OK from post addAnimal";
}
@Secured({Role.Code.USER, Role.Code.ADMIN})
@GetMapping(path = "/all")
public Collection<String> getAnimals() {
return List.of("OK from get");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment