当前位置:   article > 正文

【Bug修复】解决SpringMVC中Cannot deserialize value of type `java.util.Date` from String_cannot deserialize value of type `java.lang.boolea

cannot deserialize value of type `java.lang.boolean` from string "1": only

在配置文件中加入以下代码:(时间解析)

  1. <mvc:annotation-driven>
  2. <mvc:message-converters register-defaults="true">
  3. <bean class="org.springframework.http.converter.StringHttpMessageConverter">
  4. <constructor-arg value="UTF-8"/>
  5. </bean>
  6. <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
  7. <property name="objectMapper">
  8. <bean class="com.fasterxml.jackson.databind.ObjectMapper">
  9. <property name="dateFormat">
  10. <bean class="java.text.SimpleDateFormat">
  11. <constructor-arg type="java.lang.String" value="yyyy-MM-dd HH:mm:ss"/>
  12. </bean>
  13. </property>
  14. </bean>
  15. </property>
  16. </bean>
  17. </mvc:message-converters>
  18. </mvc:annotation-driven>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/610109
推荐阅读
相关标签