poohbar
04/18/2018, 4:50 PM@PostMapping so it won't use Jackson at all. Can Spring bind form data to Kotlin data class?mp
04/18/2018, 5:04 PM@PostMapping(value = ["/upload"], produces = arrayOf("application/json;charset=UTF-8"))
@ResponseBody
fun uploadStlFile(
@RequestParam(required = true) file: MultipartFile
)poohbar
04/18/2018, 5:08 PMconsumes = MediaType.APPLICATION_FORM_URLENCODED_VALUEmp
04/18/2018, 5:09 PMpoohbar
04/18/2018, 5:12 PMPersonDTO is a java class but not when it is a Kotlin data class
@PostMapping(value = "/submit", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public String submit(PersonDTO data)thatadamedwards
04/18/2018, 5:52 PMthatadamedwards
04/18/2018, 5:53 PMthatadamedwards
04/18/2018, 5:53 PMvar, you might make some headwaythatadamedwards
04/18/2018, 5:53 PMthatadamedwards
04/18/2018, 5:55 PMdata class PersonDTO (
val firstName: String,
val lastName: String,
val email: String
)thatadamedwards
04/18/2018, 5:55 PMdata class PersonDTO (
var firstName: String = "",
var lastName: String = "",
var email: String = ""
)thatadamedwards
04/18/2018, 5:56 PMthatadamedwards
04/18/2018, 5:56 PMpoohbar
04/18/2018, 6:42 PMthatadamedwards
04/18/2018, 6:59 PMthatadamedwards
04/18/2018, 7:00 PMthatadamedwards
04/18/2018, 7:00 PMthatadamedwards
04/18/2018, 7:03 PMthatadamedwards
04/18/2018, 7:04 PM@Entity data classes with a no-arg constructorthatadamedwards
04/18/2018, 7:04 PMthatadamedwards
04/18/2018, 7:05 PMinterface DTO and then have @DTO data class PersonDTOthatadamedwards
04/18/2018, 7:05 PMthatadamedwards
04/18/2018, 7:05 PM