我从 Angular5 向 REST API 发送请求(spring boot)
但是 Spring Boot 找不到 key 的值(它显示 null
),
在顶部图片上,您可以看到我从 postman 发送的原始数据。
在 Spring 启动中,我正在创建一个类和字段来接收数据。
在 Controller 中,我已经放置了 @RequestBody
这是我的 Controller :
@RequestMapping(value = "/edit/barcode_option", method = arrayOf(RequestMethod.POST))
fun editBarCodeOption(model: Model,
request: HttpServletRequest,
response: HttpServletResponse,
@RequestBody barcodeForm: SKBarcodeForm): ResponseEntity<*>?{
(barcodeService.editBarcodeOption(barcodeForm)).let { barcodeData ->
return responseOk("ok")
}
return responseBadRequest()
}
和 kotlin 类:
class SKBarcodeForm {
var id: Long? = null
var barcodeId: String? = null
var barcodeName: String? = null
var barcodeBrand: String? = null
var isHidingProfile: Boolean? = null
var isWasteAfterUsed: Boolean? = null
var isHaveToSeparate: Boolean? = null
}
谢谢你的帮助:D
最佳答案
尝试从 boolean 属性中删除前缀“is”。
关于java - Spring Boot找不到字段表单font-end,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52019075/