From the course: Spring: Design Patterns
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Repository pattern in action
- [Instructor] So now it's time to take a look at a repository in action. And I'm going to encourage you to put your seatbelts on, 'cause we're going to go through a lot of material here in this video. Go ahead and jump over into your IDE, and if you've loaded the exercise files, the first thing I want you to notice is in source by resources, I've added a data.sql and a schema.sql. And we're just going to use that to populate a database so we can actually implement the pattern. Let's go ahead and open up our base package. Before we do anything else, we will create a package called repository. Now, because we're using Maven and Spring, we need to add a few things to our pom. Let's jump into our pom file here. And we're going to add two dependencies. The first dependency that we're going to add is spring-boot-starter-data-jpa. And that comes from org.springframework.boot. We'll allow Maven do its resolution there while we add our second dependency. And this one is called h2. And this…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.