![](/img/trans.png)
[英]Angular2 frontend Spring Boot backend on Google cloud platform
[英]Google cloud platform Kotlin Spring App tutorial
我完成了使用 Google Cloud Platform 构建 Kotling Spring 应用程序,我们在其中创建了一个应用程序,该应用程序接受注册人信息,将其发布到 Cloud Pub/Sub 主题,并将其持久化到 Cloud MySQL 数据库。
我想知道您将如何从数据库中删除注册人。 我知道在 Java 中它会是
@DeleteRegistrant("{lastName}")
void delete () {
registrant.delete(lastName);
}
我想知道是否有人可以帮助我在 kotlin 中看起来如何。
正如本教程中提到的,你可以在你的 kotlin 应用程序中拥有这样的东西
@DeleteRegistrant("{id}")
fun deleteRegistrantById(@PathVariable(value = "id") regId: Long): ResponseEntity<Void> {
return registrantRepository.findById(regId).map { reg ->
registrantRepository.delete(reg)
ResponseEntity<Void>(HttpStatus.OK)
}.orElse(ResponseEntity.notFound().build())
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.