Spring Applications

Exercise: Todo REST Client

  1. Add the Maven dependencies org.springframework:spring-web, com.fasterxml.jackson.core:jackson-databind and com.fasterxml.jackson.datatype:jackson-datatype-jsr310 to the todo application.
  2. Remove the repository and the JPA annotations from the Todo class and rename the TodoService class into TodoProxy.
  3. Use the Spring RestClient to implement the proxy methods which send REST requests to the web service (see API Documentation).
  4. In the findTodo and updateTodo methods catch the HttpClientErrorException.NotFound exception, get the problem detail from the response body and rethrow a TodoNotFoundException.
Solution