Skip to content

Integrating Spring Boot and JPA

Integrating a JPA project into Spring Boot is simple.

  • We will do this by creating a separate Spring Boot Project, and using Gradle to pull the JPA project into it.

  • Gradle automates the inclusion of the JPA project into the Spring Boot Project. Each time our Web Project is built/deployed, Gradle loads in the JPA project.

Practice Exercise

NOTE: This setup process is a good template for how to set up your group project.


Drill

NOTE: STS makes multiple project builds a little bit difficult to manage with a single Github repository. As a result, we recommend that you create a new workspace as an umbrella for each new site. In this workspace you will create a JPA and Spring Boot project. You will then initialize that workspace as a Git repository.

For this drill, we will use the existing VideoStore workspace.

  1. Open your VideoStore workspace.
  2. Execute a Gradle Refresh on your project to bring in all dependencies.
  3. In the Gradle Tasks view, run the verification | test task and make sure all your JPA unit tests pass.
  4. Create a new Spring Starter Project with the name BootMVCVideoStore.
  5. Set the Type to Gradle.
  6. Set the Java Version to 8.
  7. Set the Packaging to War.
  8. Set the Package to com.example.bootmvc.
  9. Add the Spring Web, Spring Data JPA, and MySQL Driver dependencies to your project.
  10. Be sure to include all three dependencies.
  11. Build the project with Finish.

Prev -- Up -- Next