concept Spring Data repository in category spring

appears as: Spring Data repository, Spring Data repositories, Spring Data repositories
Spring Security in Action

This is an excerpt from Manning's book Spring Security in Action.

Listing 6.8 The definition of the Spring Data repository for the User entity
public interface UserRepository extends JpaRepository<User, Integer> {
 
  Optional<User> findUserByUsername(String username);    #A
}

17.3  Using filtering in Spring Data repositories

In this section, we discuss filtering applied with Spring Data repositories. It’s important to understand this approach because we very often use databases to persist the data of our applications. It is pretty common nowadays to implement Spring Boot applications that use Spring Data as a high-level layer to connect to a database, be it SQL or NoSQL. We discuss two approaches for applying filtering at the repository level when using Spring Data, and we implement them in examples. The first approach we take is the one you’ve learned up to now in the chapter: using the @PreFilter and @PostFilter annotations. The second approach we’ll discuss is the direct integration of the authorization rules in queries. As you’ll learn in this section, you have to be attentive when choosing the way you apply filtering at the Spring Data repositories.