我有以下代码:
broadcastMessage
邮递员调用此方法时,给我一个错误。
@PostMapping()
public ResponseEntity<Object> postAccounts(
@RequestHeader(value = "client-id", required = true) String clientId,
@RequestHeader(value = "X-client-Global-Id", required = false) String clientGlobalID,
@RequestHeader(value = "Authorization", required = true) String authorization,
@Valid @RequestBody(required = true) String inputContract, @RequestBody(required = true)String nameInput, @RequestBody(required = true) Boolean state) {
return new ResponseEntity<>(inputContract, HttpStatus.OK);
}
答案 0 :(得分:3)
如果要在正文中发送多个属性,则只能发送一个RequestBody。您必须创建一个对象
@PostMapping()
public ResponseEntity<Object> postAccounts(
//Other Headers...,
@Valid @RequestBody(required = true) ObjectWithAllFields) {
return new ResponseEntity<>(ObjectWithAllFields, HttpStatus.OK);
}
编辑1
请发送您的错误跟踪。