是的,方法是添加手工制作的基础存储库。您通常使用以下内容:
public interface ReadOnlyRepository<T, ID extends Serializable> extends Repository<T, ID> { T findOne(ID id); Iterable<T> findAll();}现在,您可以使刚刚定义的具体回购扩展:
public interface PersonRepository extends ReadOnlyRepository<Person, Long> { T findByEmailAddress(String emailAddress);}定义基本存储库的关键部分是,方法声明 与 声明的方法 具有相同的签名
,在
CrudRepository这种情况下,我们仍然可以将调用路由到支持存储库代理的实现Bean中。我在SpringSource博客中写了一篇关于该主题的更详细的博客文章。



