Closed
Description
I have a kotlin class with a non-nullable property, which is not using a primitive type in the jvm, and I'm trying to use the properties of that class as request parameters. If I don't include that property as a request parameter, I would expect a bad request response. However, it instead crashes with this exception:
java.lang.IllegalArgumentException: Parameter specified as non-null is null: method no.finntech.iaap.data_import.Params.<init>, parameter a
This is the code I'm using:
class Params(
val a: String
)
@SpringBootApplication
@RestController
class Application {
@GetMapping("/test")
fun test(params: Params) = ""
}
If a
is of type Int
instead, or if I use a non-nullable String
directly in the arguments to test
as a RequestParam
, I get a bad request as expected.