zoukankan      html  css  js  c++  java
  • JodaTime library not available

    使用spring的@DateTimeFormat来格式化Date类型时,报错:

    org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
    Field error in object 'modelInfoExample' on field 'birthday':
    rejected value [2014-12-09];
    codes [typeMismatch.modelInfoExample.birthday,typeMismatch.birthday,typeMismatch.java.util.Date,typeMismatch];
    arguments [org.springframework.context.support.DefaultMessageSourceResolvable:
    codes [modelInfoExample.birthday,birthday]; arguments []; default message [birthday]];
    default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date'
    for property 'birthday'; nested exception is org.springframework.core.convert.ConversionFailedException:
    Failed to convert from type java.lang.String to type @org.springframework.format.annotation.DateTimeFormat
    java.util.Date for value '2014-12-09'; nested exception is
    java.lang.IllegalStateException: JodaTime library not available - @DateTimeFormat not supported]

    很明显,确实 JodaTime 库,在pom.xml中加入其依赖,搞定:

    <dependency>
    			<groupId>joda-time</groupId>
    			<artifactId>joda-time</artifactId>
    			<version>2.6</version>
    		</dependency>
    
  • 相关阅读:
    拷贝构造函数与赋值运算符的区别(待完善)
    概念学习(Concept Learning)
    函数对象适配器之ptr_fun的使用示例
    SynchronizationContext的研究之一(非WPF及Forms)
    ESLint
    Vue CLI 4.0 关于 webpack 基本配置范例
    Hdu3787
    Cf393A
    Cf387A
    Cf386B
  • 原文地址:https://www.cnblogs.com/digdeep/p/4186627.html
Copyright © 2011-2022 走看看