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