Spring Beans With Auto-Generated Implementations: How-To

Introduction

Quite a few frameworks implement the automatic creation of components from Java interfaces. The most popular one is probably Spring Data, which is a whole family of data access frameworks. Spring Data JPA, for instance, helps us run JPA queries. Here's a quick example:

Java
 
public interface ClientRepository extends JpaRepository<Client, Long> {
  List<Client> findByNameLikeAndLastActiveBefore(String name, Date date);
}