Spring REST,Kotin和默认的基本参数导致错误

我得到一个错误:

可选的长参数“count”存在,但由于被声明为基本类型而不能被转换为空值。 考虑将其声明为相应原始类型的对象包装

当我尝试调用这个REST控制器。

@RequestMapping("/api/audio/tracks", produces = arrayOf(APPLICATION_JSON_VALUE)) interface SomeApi { @RequestMapping(method = arrayOf(GET)) fun list(@RequestParam("count", defaultValue = "10") count: Long): Any } 

不会春天看defaultValue吗?

如何解决这类问题?

!Kotlin默认也不起作用

我在我的情况下找到解决方案:

原因是因为有一个界面。 当我在实现中放置@RequestParam("count", required = false, defaultValue = "10")时,所有东西都开始工作。