Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用BigDecimal值发送POJO返回null_Java_Spring_Spring Cloud_Spring Cloud Feign_Feign - Fatal编程技术网

Java 使用BigDecimal值发送POJO返回null

Java 使用BigDecimal值发送POJO返回null,java,spring,spring-cloud,spring-cloud-feign,feign,Java,Spring,Spring Cloud,Spring Cloud Feign,Feign,我有一个Spring佯装客户端,它正在使用POST将POJO对象发送到远程端点: SaleRequestFactory obj = new SaleRequestFactory(); obj.setId(insertedTransaction.getId()); obj.setAmount(wpfRequestDTO.getAmount()); DTO: 当我尝试获取金额时,我得到: nested exception is java.lang.NullPoint

我有一个Spring佯装客户端,它正在使用POST将POJO对象发送到远程端点:

SaleRequestFactory obj = new SaleRequestFactory();
        obj.setId(insertedTransaction.getId());
        obj.setAmount(wpfRequestDTO.getAmount());
DTO:

当我尝试获取金额时,我得到:

nested exception is java.lang.NullPointerException: Cannot invoke "java.math.BigDecimal.doubleValue()" because the return value of "org.SaleRequestFactory.getAmount()" is null] with root cause
java.lang.NullPointerException: Cannot invoke "java.math.BigDecimal.doubleValue()" because the return value of "org.SaleRequestFactory.getAmount()" is null
当收到POST请求时,Spring是否可能未正确转换
bigdecimic

我是否需要将值转换为
整数
,以便正确读取数字?

您发送了什么
BigDecimal
值?Stacktrace说你的值为空。尝试在
BigDecimal
字段中添加
@JsonInclude(Include.NON_NULL)
。请更新您的问题并向我们显示您发送的请求,好吗?进一步说,
java.math.BigDecimal.doubleValue()调用在哪里?
nested exception is java.lang.NullPointerException: Cannot invoke "java.math.BigDecimal.doubleValue()" because the return value of "org.SaleRequestFactory.getAmount()" is null] with root cause
java.lang.NullPointerException: Cannot invoke "java.math.BigDecimal.doubleValue()" because the return value of "org.SaleRequestFactory.getAmount()" is null