I get an error:
Optional long parameter 'count' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type
when I try to invoke this REST controller.
@RequestMapping("/api/audio/tracks", produces = arrayOf(APPLICATION_JSON_VALUE))
interface SomeApi {
@RequestMapping(method = arrayOf(GET))
fun list(@RequestParam("count", defaultValue = "10") count: Long): Any
}
Does not spring look at defaultValue
?
How to solve this kind of problem?
!Kotlin defaults do not work either
I found solution in my situation:
The reason was because of an interface. When I placed @RequestParam("count", required = false, defaultValue = "10")
in the implementation everything start working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With