Exception handling: No value specified for'Date'

1. The reason for the exception.
Using BeanUtils.copyProperties(model,bo), the data source object model has a parameter of java.util.Date type. Because the imported org.apache.commons.beanutils.BeanUtils has no initialized value, BeanUtils is called. .copyProperties method,
error No value specified for Date

2. Solution

1. Add before copy

ConvertUtils.register(new DateConverter(null), java.util.Date.class);

2. When Import Import BeanUtils class, select

org.springframework.beans.BeanUtils

It's ok

.
.
.
Afterword: After I found out that my white shoes were dirty, my partner would brush me clean, so I decided to buy only white shoes from now on.

Guess you like

Origin blog.csdn.net/weixin_43945983/article/details/105409099