Spring Boot Hateoas的Kotlin递归问题

问题描述

我正在通过Spring Boot教程来创建RESTful服务。该示例在Java中,而我在IntelliJ IDEA的Kotlin中进行。但是,当我尝试使用下面的代码创建一个自我链接时,遇到了Kotlin递归问题。

select username from tablename
where username not in 
     (select distinct username from tablename where submission>='2020-08-14' 
and submission<='2020-08-15')

IDE抱怨@GetMapping("/employees/{id}") fun one(@PathVariable id: Long) = repository.findByIdOrNull(id)?.let { employee -> EntityModel.of(employee,linkTo<EmployeeController> { WebMvcLinkBuilder.methodOn(EmployeeController::class.java).one(id) }.withSelfRel() ) } ?: throw EmployeeNotFoundException(id) 导致“类型检查遇到了递归问题。最简单的解决方法:显式指定声明的类型”

有人知道解决方案吗?还是无法与Kotlin创建自我链接?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...