We explored the building of web apps using Spring MVC in Chapter 2, Building the Web Layer with Spring Web MVC. In Chapter 3, Accessing Data with Spring, we also learned how to persist data using Spring Data JPA. We are going to apply both these techniques again for building an API application for Taskify.
Since we have already learned the basics of creating Spring MVC applications with Spring Data JPA, at this point, we will go into detail only about the specifics of the API endpoints. Refer to Chapter 2, Building the Web Layer with Spring Web MVC for Spring MVC configuration and Chapter 3, Accessing Data with Spring for details about Spring Data JPA. Set up and configure the project with the following steps:
Create a Spring MVC application with a dependency on Spring Data JPA and the database of your choice.
Enable JPA repositories, specifying the base packages. For JavaConfig, annotate like this:
@EnableJpaRepositories(basePackages...