Is there any possibility to use default values wit...
# spring
i
Is there any possibility to use default values with primitives in spring controller? This way I'm getting exception:
Copy code
@GetMapping
fun get(@RequestParam(required = false) limit: Int = 10): String {
    return limit.toString()
}
java.lang.IllegalStateException: Optional int parameter 'limit' 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.
Different approach works fine but I would like to avoid it:
Copy code
@GetMapping
fun get(@RequestParam(required = false, defaultValue = "10") limit: Int): String {
    return limit.toString()
}