From the course: Creating Spring Boot Microservices
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Invoking the repositories - Spring Boot Tutorial
From the course: Creating Spring Boot Microservices
Invoking the repositories
- [Instructor] Now let's invoke the repositories by launching the application. So we are in the application main class and we need to load the database with the collection of predefined tours and tour packages. The Explore California Travel Agency provided us with a .JSON file that represents all the possible tours and it's in the main explorer of ExploreCalifornia. There it is right there. Some of the fields map directly to the fields in our tour entity like title, description, and blurb. However some fields like price, tour package, difficulty, region, those all require conversion and in ExplorecaliApplication, that's where we're going to do that. Our Explorecali web application uses an in-memory database called H2. Spring Boot connects to H2 with the default when the dependency is provided. We need to load the data each time the application starts. So now we have services to create the tours and tour packages, but how should we invoke them before accepting web requests? Remember…
Contents
-
-
-
-
-
(Locked)
The domain model2m 9s
-
(Locked)
The persistence entities2m 2s
-
(Locked)
Declare JPA repositories4m 36s
-
(Locked)
Spring Data JPA repository dependency injection3m 48s
-
(Locked)
Invoking the repositories7m 33s
-
(Locked)
Introduction to Spring Data query methods3m 2s
-
(Locked)
Challenge: Create a JPQL query method38s
-
(Locked)
Solution: Create a JPQL query method2m 35s
-
(Locked)
-
-
-
-
-
-
-