From the course: Creating Your First Spring Boot Microservice
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Introduction to Spring Data query methods
From the course: Creating Your First Spring Boot Microservice
Introduction to Spring Data query methods
- [Instructor] We need to look up the tour package by the name. The code is not provided in the JSON import file. We accomplish this by creating query methods in the tour package repository interface. So let's open Tour package repository. And now I'm going to add a method. I'm going to call the method find by name passing in a string, which is the name of the tour package. Now back in tour service, I'm going to use that find by name instead of find by D. And now let's actually run the application again. So we ran Tomcat and it started up just fine. It didn't throw any exceptions. And is it magic? Is it a miracle? Well, no, it's not magical at all in the introspection and reflection spring implements the method under the covers for us but we must follow their rules for declaring methods and correctly map the entity properties to the method signature. Query methods are a great code saver spring data JPA…
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.