缺少 CrudRepository#findOne 方法 [英] Missing CrudRepository#findOne method
本文介绍了缺少 CrudRepository#findOne 方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的项目中使用 Spring 5.直到今天还有可用的方法 CrudRepository#findOne
.
I am using Spring 5 in my project. Until today there was available method CrudRepository#findOne
.
但是下载最新的快照后,它突然消失了!有没有参考说现在这个方法不可用?
But after downloading latest snapshot it suddenly disappeared! Is there any reference that the method is not available now?
我的依赖列表:
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
runtime 'com.h2database:h2:1.4.194'
}
更新:
似乎这个方法已经被替换为CrudRepository#findById
Seems that this method has been replaced with CrudRepository#findById
推荐答案
请看DATACMNS-944 与 此提交相关联,它具有以下内容重命名
Please see DATACMNS-944 which is associated to this commit which has the following renames
╔═════════════════════╦═══════════════════════╗
║ Old name ║ New name ║
╠═════════════════════╬═══════════════════════╣
║ findOne(…) ║ findById(…) ║
╠═════════════════════╬═══════════════════════╣
║ save(Iterable) ║ saveAll(Iterable) ║
╠═════════════════════╬═══════════════════════╣
║ findAll(Iterable) ║ findAllById(…) ║
╠═════════════════════╬═══════════════════════╣
║ delete(ID) ║ deleteById(ID) ║
╠═════════════════════╬═══════════════════════╣
║ delete(Iterable) ║ deleteAll(Iterable) ║
╠═════════════════════╬═══════════════════════╣
║ exists() ║ existsById(…) ║
╚═════════════════════╩═══════════════════════╝
这篇关于缺少 CrudRepository#findOne 方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文