Spring Applications

Exercise: Todo REST Service

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