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>
    
  • 相关阅读:
    vue chrome调试工具开启
    mac显示隐藏文件
    mac网络变慢?
    57-文件处理小结
    56-文件修改的两种方式
    54-with管理文件操作上下文
    53-文件的三种打开方式
    51-基本文件操作
    50-Python2和3字符编码的区别
    49-字符编码
  • 原文地址:https://www.cnblogs.com/digdeep/p/4186627.html
Copyright © 2011-2022 走看看