Problema : Failed to convert property value of type [java.lang.String] to required type [java.util.Date] for property ‘xxx’; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [java.util.Date] for property ‘xxx’: no matching editors or conversion strategy found
O problema aqui é bem simples, a injeção da propriedade ‘xxx’ que é do tipo Date é considerada como String por Spring. No caso tem que se criar um bean especifico para customizar a data.
Solução:
<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer"> <property name="customEditors"> <map> <entry key="java.util.Date"> <bean class="org.springframework.beans.propertyeditors.CustomDateEditor"> <constructor-arg index="0"> <bean class="java.text.SimpleDateFormat"> <constructor-arg value="yyyy-MM-dd" /> </bean> </constructor-arg> <constructor-arg index="1" value="false" /> </bean> </entry> </map> </property> </bean











[...] Pra finalizar, fazer o processo do post Spring Date Injection. [...]