Implement RegistrationApiController and its dependencies

Now, let's move on to implement RegistrationApiControler and its dependencies. The full name of the controller is com.taskagile.web.apis.RegistrationApiController, and it looks like the following:

...@Controllerpublic class RegistrationApiController {  private UserService service;  public RegistrationApiController(UserService service) {    this.service = service;  }  @PostMapping("/api/registrations")  public ResponseEntity<ApiResult> register(      @Valid @RequestBody RegistrationPayload payload) {    try {      service.register(payload.toCommand());      return Result.created();    } catch (RegistrationException e) {    String errorMessage = "Registration failed";      if (e instanceof UsernameExistsException) { errorMessage ...

Get Building Applications with Spring 5 and Vue.js 2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.