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>
    
  • 相关阅读:
    Python之eval的使用
    Python文件操作
    Python异常处理
    Python设计模式之单例模式
    Python面向对象
    Minimum Window Substring
    Minimum Size Subarray Sum
    Find Minimum in Rotated Sorted Array II
    Closest Binary Search Tree Value II
    Closest Binary Search Tree Value
  • 原文地址:https://www.cnblogs.com/digdeep/p/4186627.html
Copyright © 2011-2022 走看看