In the previous sections, we looked at the CrudRepository and PagingAndSortingRepository interfaces. We looked at the different methods that they provided by default. Spring Data does not stop here. It defines a few patterns that allow you to define custom query methods. In this section, we will look at examples of some of the options Spring Data provides to customize your query methods.
We will start with examples related to finding rows matching specific attribute values. The following example shows different methods in order to search for the User by their name:
public interface UserRepository extends PagingAndSortingRepository<User, Long> { List<User> findByName(String name); List<User> findByName(String name, Sort sort); ...