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 TodoListProxy.
  3. Inject the Spring RestTemplateBuilder into the proxy and use it to create RestTemplate object.
  4. Use the template to re-implement the proxy methods which send REST requests to the web service (see API Documentation).
  5. In the findTodo and updateTodo methods catch the HttpClientErrorException.NotFound exception and rethrow a TodoNotFoundException.
Solution