Весенний запрос на загрузкуJAVA

Программисты JAVA общаются здесь
Anonymous
Весенний запрос на загрузку

Сообщение Anonymous »

Я новичок в весенней загрузке, у меня есть небольшая проблема, когда я получаю JSON в моем RestController от почты.

Код: Выделить всё

@RestController
@RequestMapping(value="/api/enviar",produces = MediaType.APPLICATION_JSON_VALUE,
headers = {"content-type=application/json"})
@RequiredArgsConstructor
@Slf4j
public class EnviarAdicionService {
@Autowired
private final EnviarAdicionUseCase enviarAdicionUseCase;
@Autowired
private final GuardarLogUseCase guardarLogUseCase;

private final Gson gson = new Gson();
private String _statusCode;
private Date dateStart;

@PostMapping
public DatosAdicionResponse PostAdicionFondos(@RequestBody @Valid RequestAdicion requestAdicion){
//PostMapping logic
...
}
}
< /code>
Мой запрос похож на это: < /p>
@Data
@NoArgsConstructor
public class RequestAdicion implements Serializable {
private final static String regExpression = "\\{\\[sw\\.,ñÑ]\\+\\$}";
@RequestHeaderValidation
private RequestHeader Header;
@CuentaValidation(NumeroIdentificacionName = "NumeroDocumentoCuentaOrigen", TipoIdentificacionName = "TipoDocumentoCuentaOrigen",
TipoCuentaDepositosName = "TipoCuentaDepositoOrigen", NumeroCuentaDepositoName = "NumeroCuentaDepositoOrigen",
EntidadCuentaName = "EntidadCuentaOrigen", TipoCuentaName = "TipoCuentaOrigen", NumeroCuentaName = "NumeroCuentaOrigen",
CodigoFondoName = "CodigoFondoCuentaOrigen", EntidadCuentaDepositoName = "EntidadCuentaDepositoOrigen")
private CuentaOrigen CuentaOrigen;
@CuentaFondoValidation(TipoIdentificacionName = "TipoDocumentoCuentaDestino", NumeroIdentificacionFondoName = "NumeroDocumentoCuentaDestino",
EntidadName = "EntidadCuentaDestino", CodigoFondoName = "CodigoFondoCuentaDestino",
NumeroFondoInversionName = "NumeroFondoInversionCuentaDestino")
private CuentaFondo CuentaDestino;
@FormaDePagoValidation
@Pattern(regexp = regExpression,message = "Valor no permitido. FormaDePago")
private String FormaDePago;
@ValorValidation
private double ValorAdicion;
@OficinaValidation
private long Oficina;
@CanalValidation
@Pattern(regexp = regExpression,message = "Valor no permitido. Canal")
private String Canal;
}
< /code>
Я посылаю эти атрибуты в почте, < /p>
Headers
Content-Type: application/json

Body
{
"Header": {
"SystemId": "AW1371",
"MessageId": "1234567890120006",
"UserName": "autWakanda",
"Destination": {
"Name": null,
"NameSpace": null,
"Operation": null
}
},
"CuentaOrigen": {
"NumeroDocumentoCuentaOrigen": 8232166,
"TipoDocumentoCuentaOrigen": "1",
"TipoCuentaDepositoOrigen": "7",
"NumeroCuentaDepositoOrigen": "40673760005",
"EntidadCuentaOrigen": "00007",
"TipoCuentaOrigen": "7",
"NumeroCuentaOrigen": "40673760005",
"CodigoFondoCuentaOrigen": "123"
},
"CuentaDestino": {
"TipoDocumentoCuentaDestino": "1",
"NumeroDocumentoCuentaDestino": 1360740,
"NumeroFondoInversionCuentaDestino": "0021008106434090",
"EntidadCuentaDestino": "00532",
"CodigoFondoCuentaDestino": "21"
},
"FormaDePago": "72",
"ValorAdicion": 133000.31,
"Oficina": 3132,
"Canal": "SVE"
}
< /code>
Я попытался установить первый символ в нижнем регистре, но он не работает. < /p>
Это исключение, поднятое: < /p>
Caused by: java.lang.NullPointerException: Cannot invoke "co.com.bancolombia.model.requestheader.RequestHeader.getSystemId()" because the return value of "co.com.bancolombia.api.models.RequestAdicion.getHeader()" is null
Спасибо всем заранее.>

Подробнее здесь: https://stackoverflow.com/questions/666 ... tting-null

Вернуться в «JAVA»