Spring Web

Exercise: Todo REST Client

  1. Clone the GitLab repository Todo and copy the application.
  2. Remove the persistence artifacts (dependencies, repository, entity annotaions) and add the spring-boot-starter-webmvc Maven dependency.
  3. Rename the TodoService class to TodoProxy.
  4. Use the Spring RestClient to implement the proxy methods which send REST requests to the web service.
  5. In the findTodo and updateTodo methods catch the HttpClientErrorException.NotFound exception, get the problem detail using the getResponseBodyAs method and rethrow a TodoNotFoundException.
  6. Start the client application without web server:
    new SpringApplicationBuilder(Application.class).web(NONE).run(args);
    

Solution