使用CustomRepository FPGA实现带弹簧的引导和弹簧数据的JPA
问题描述:
背景使用CustomRepository FPGA实现带弹簧的引导和弹簧数据的JPA
我试图创建我的春天引导数据JPA应用程序的自定义实现。
我用“List<User> getUsers(String type)
”方法创建了一个UserRepsitoryCustom
接口。
我创建了一个UserRepository
接口,扩展CrudRepository<User, Long>, QueryDslPredicateExecutor<User>, UserRepositoryCustom
。
我创建了UserRepositoryImpl
类,它扩展了UserRepositoryCustom
接口并实现了“getUsers(String type)
”方法。
问题
我的预期是,春引导数据JPA将创造我一个仓库豆,结合所有的好东西从CrudRepository
& QueryDslPredicateExecutor
和额外的会知道使用个性化的实现库。
目前,所有我得到的是
PropertyReferenceException:未发现财产getUsers ...
我还没有与任何@Component
或@Repository
注释的UserRepositoryImpl
。并且我没有更改任何默认配置。
我在做什么错?
谢谢!
答
我发现了我的问题! UserRepositoryImpl的包名是错误的......我将它移到了正确的包名上,并且完成了!
在'UserRepository接口'处用'@Transactional'试一试。但是根据你的问题,你的代码将会帮助你很大程度上帮助你 – Patrick
。但显然不能这样,因为你有错误。再次按照这些步骤http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.single-repository-behaviour。如果你仍然面临这个问题。张贴源代码。还要确保你没有改变仓库impl postfix的配置。 –