@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<?> create(@RequestBody CreateAccountCommand createAccountCommand) throws URISyntaxException { final String id = accountService.create(createAccountCommand); return ResponseEntity.created(new URI("http://localhost:8080/accounts/" + id)).build(); }
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<List<AccountResource>> list() { final List<AccountResource> accounts = accountService.getAccounts(); return ResponseEntity.ok(accounts); }