What you did is CORRECT for only one class (Date). This is achieved for all supported types, including Date, by calling the register method on ConvertUtilsBean , as shown below:
ConvertUtilsBean convertUtilsBean = BeanUtilsBean.getInstance().getConvertUtils(); convertUtilsBean.register(false, true, -1);
Here, the first argument false means that it does not throw a conversion exception. The second argument true represents, if there is an exception, uses null as the default value. The third argument -1 means that the array types will default to null. If you want arrays with a specific size by default, specify the size as the third parameter.
See here (ConvertUtilsBean Javadoc) for more details.
source share