No value specified for Date (没有为“Date”指定值)

运行单元测试,或者跑程序 时,使用BeanUtils复制对象属性,结果抛出了No value specified for Date异常。

原因是:数据源orig有一个参数是java.util.Date类型,没有初始化值,调用了BeanUtils.copyProperties方法。

解决办法:

  在使用方法之前执行来上这么一句,就解决了。ConvertUtils.register(new DateConverter(null), java.util.Date.class);

猜你喜欢

转载自www.cnblogs.com/whl-jx911/p/12964583.html
今日推荐