Spring Applications

Exercise: Todo REST Client

  1. Remove the persistence dependencies from the todo application and add the spring-boot-starter-restclient Maven dependency.
  2. Remove the repository and the JPA annotations from the Todo class and rename the TodoService class to TodoProxy.
  3. Use the Spring RestClient to implement the methods of the TodoProxy which send appropriate HTTP requests to the REST service.
  4. In the completeTodo and removeTodo methods catch the HttpClientErrorException.NotFound exception, get the problem detail using the getResponseBodyAs method and rethrow a TodoNotFoundException.

Solution