使用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>

JodaTime library not available - @DateTimeFormat not supported的更多相关文章

  1. Downloading the Google Cloud Storage Client Library

    Google Cloud Storage client是一个客户端库,与任何一个生产环境使用的App Engine版本都相互独立.如果你想使用App Engine Development server ...

  2. wesome-android

    awesome-android Introduction android libs from github System requirements Android Notice If the lib ...

  3. gradle大体内容

    buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:grad ...

  4. 30 个很棒的 PHP 开源 CMS 内容管理系统

    本文汇集了30个优秀的开源CMS建站系统,采用PHP开发.以下列表不分先后顺序. 1. AdaptCMS AdaptCMS Lite 是一个开源的CMS系统,主要特点是易用,而且可以轻松和其他系统接驳 ...

  5. android MultiDex multidex原理下超出方法数的限制问题(三)

    android MultiDex 原理下超出方法数的限制问题(三)    插件化?自动化?multiDex?是不是觉得已经懵逼了?请先看这篇文章的内容,在下篇文章中将会详解具体的过程- 随着应用不断迭 ...

  6. Awesome Big Data List

    https://github.com/onurakpolat/awesome-bigdata A curated list of awesome big data frameworks, resour ...

  7. springmvc配置之mvc:annotation-driven

    为了简化springmvc配置,spring同时引入了mvc namespace, 配置了 <mvc:annotation-driven/> spring会默认注册a RequestMap ...

  8. Robot framework--内置库xml学习(一)

    Using lxml By default this library uses Python's standard ElementTree module for parsing XML, but it ...

  9. Android方法引用数超过65535优雅解决

    随着应用不断迭代更新,业务线的扩展,应用越来越大(比如:集成了各种第三方SDK或者公共开源的Library文件.jar文件)这样一来,项目耦合性就很高,重复作用的类就越来越多了,SO:问题就来了.相信 ...

随机推荐

  1. 利用IronJs在.NET程序里面跑javascript脚本

    what’s dlr The dynamic language runtime (DLR) is a runtime environment that adds a set of services f ...

  2. 一个App的界面设计流程是怎么产生的

    作者:候佩雯链接:http://www.zhihu.com/question/27088793 完整的流程,分层次设计,自下而上去完成: 策略层,定义产品使命.价值.目标人群 愿景/功能层:定义核心场 ...

  3. 利用name或id属性设置页面跳转的锚点

    理论准备         网页中的链接按照链接路径的不同,可以分为3种类型,分别是内部类型.锚点链接和外部链接:         按照使用对象的不同,网页中的链接又分为文本超链接,图像超链接,E-ma ...

  4. 新的Visual C++代码优化器

    微软在 5 月 4 日发布了新的高级代码优化器,服务于 Visual C++ 的后端编译器.提高了代码性能,可以压缩代码体积,将编译器带入了一个新的境界. Visual C++ 的团队在博客上称,这将 ...

  5. DevExpress GridControl功能总结

    写在前面,Dev控件已经很久了,功能也很强大,截止到现在我编写文档出来的Dev的版本已经到了14.1了,看了Demo真的很强大,效果也很好,结合自己这一个月开发,分享一下自己研究过后的经验,不让大家走 ...

  6. hibernate4整合spring3事务问题

    本文是作者在对hibernate4+spring3+struts2整合中遇到的一个问题.对s2sh进行了基本的整合搭建以后,就是对事务的控制管理,将hibernate的事务交由spring管理.根据网 ...

  7. 两种设计模式(2)==>>"单例"

    所谓“单例”: 单例模式是一种常用的软件设计模式.在它的核心结构中只包含一个被称为单例的特殊类.通过单例模式可以保证系统中一个类只有一个实例而且该实例易于外界访问,从而方便对实例个数的控制并节约系统资 ...

  8. ahjesus 部署lighttpd

    这个就不写了,直接传送门过去看,按照说的做就可以了 如果你想要安装最新版的,传送门 需要注意的是configure这一步,你看完他的help以后还要输入 ./configure 才能继续下一步 再就是 ...

  9. 使用Jsoup解析html网页

    一.   JSOUP简介 在以往用java来处理解析HTML文档或者片段时,我们通常会采用htmlparser(http://htmlparser.sourceforge.net/)这个开源类库.现在 ...

  10. 设计模式之桥接模式(Bridge)

    注:本文不属于原创,而是根据原文重新整理,原文是:我给媳妇解释设计模式:第一部分 设计模式不是基于理论发明的.相反,总是先有问题场景,再基于需求和情景不断演化设计方案,最后把一些方案标准化成“模式”. ...