Spring Data – Add custom method to Repository
In this article, we will show you how to add a custom method to Spring Data JPA CrudRepository and MongoDB MongoRepository 1. CrudRepository 1.1 Review a CustomerRepository, we will add a custom method to this repository. CustomerRepository.java package com.mkyong.dao; import com.mkyong.model.Customer; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; import java.util.Date; import java.util.List; import java.util.stream.Stream; public interface …