背景使用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
。並且我沒有更改任何默認配置。
我在做什麼錯?
謝謝!
在'UserRepository接口'處用'@Transactional'試一試。但是根據你的問題,你的代碼將會幫助你很大程度上幫助你 – Patrick
。但顯然不能這樣,因爲你有錯誤。再次按照這些步驟http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.single-repository-behaviour。如果你仍然面臨這個問題。張貼源代碼。還要確保你沒有改變倉庫impl postfix的配置。 –