Spring Applications
Exercise: Todo REST Service
- Remove the client from the todo application and add the
spring-boot-starter-web Maven dependency.
- Rename the
TodoService class to TodoController and annotate it using Spring Web MVC annotations.
- Replace the multiple parameters of the
addTodo method by a single todo object and add an ID path variable to the updateTodo method.
- Implement an exception handler for the
TodoNotFoundException such that the error status 404 and a problem detail is returned when the exception is thrown.
- Set the
spring.mvc.problemdetails.enabled application property to enable general support for problem details.
- Use the Postman utility to send REST requests the web service.
Solution