Shawn A
06/22/2020, 10:55 PM@GetMapping("/api/users")
fun getAll(user: User) = Mono.just(user)
-- snip --
data class User(
val firstName: String,
val address: Address
)
data class Address(
val street: String
)
Curl:
curl '<http://localhost:8080/api/users?firstName=shawn&address.street=foo>'
500 error:
org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.expediagroup.application.User]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: Parameter specified as non-null is null: method com.expediagroup.application.User.<init>, parameter address
I am pretty sure this works with the servlet API.thanksforallthefish
06/23/2020, 6:29 AMdata class User(
val firstName: String,
val address: Address = Address("")
)
quickly tested with servlet, I think I had the same problem a couple of years back and resulted in not using nested objects for query params. but ofc in a couple years improvements might have comeShawn A
06/23/2020, 8:09 PMWesley Acheson
06/24/2020, 5:20 PMWesley Acheson
06/24/2020, 5:22 PMShawn A
06/24/2020, 11:31 PM