【问题标题】:BeanUtils.setProperty throws exception with value NULLBeanUtils.setProperty 抛出值为 NULL 的异常
【发布时间】:2022-07-22 04:16:19
【问题描述】:

我正在使用 org.apache.commons.beanutils.BeanUtils.setProperty(bean,name,value)。 当值为 NULL 时,它会引发异常。 在类内部挖掘导致异常的是 ConverterUtilsBean.convert 方法,更具体地说是不接受 null 的 BigDecimalConverter.convert。 我该如何克服这个问题?

提前致谢。 最好的问候。

【问题讨论】:

    标签: java null apache-commons-beanutils


    【解决方案1】:
    ConvertUtilsBean convertUtilsBean = BeanUtilsBean.getInstance().getConvertUtils();
    convertUtilsBean.register(false, true, -1);
    

    BeanUtils Copy Properties: Registering ConvertUtils

    看看这个帖子!

    【讨论】:

      猜你喜欢
      • 2014-02-09
      • 1970-01-01
      • 2012-12-22
      • 2012-06-08
      • 2022-12-14
      • 1970-01-01
      • 2023-04-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多