'Typing does not work when creating a map in Kotlin through spring boot @RequestParam
I am using spring boot and have made the following controller where I explicitly specify key and value types.
@PostMapping("DAC/set")
fun setDac(@RequestParam map: HashMap<Int, Float>): ResponseEntity<JSONObject> {
println(map)
return dac()
}
When I send a request like this:
http://localhost:9090/adam6024/DAC/set?a=abc,b=d,d=v
I am getting this output in console:
{a=abc,b=d,d=v}
Why am I not getting an error? Moreover, I cannot add string values to the map, my IDE does not allow me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
