找不到org.springframework.format.datetime.standard.DateTimeConverters [英] Unable to find org.springframework.format.datetime.standard.DateTimeConverters

查看:150
本文介绍了找不到org.springframework.format.datetime.standard.DateTimeConverters的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到一个Spring类org.springframework.format.datetime.standard.DateTimeConverters,其中包含一些有用的转换器.它记录在

There is a Spring class, org.springframework.format.datetime.standard.DateTimeConverters, with some useful converters, that I am not able to find. It is documented in the 4.1.0.RC1_to_4.1.0.RC2 javadoc but not in the 4.1.0.RELEASE. Note the @UsesJava8 annotation in the javadoc. Of course I am using Java 8 as I need to convert between the new types.

该类的源代码位于

The class has its source code in GitHub with the 4.1 tag and I add the project by Maven using the following xml to my pom.xml.

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>4.2.1.RELEASE</version>
</dependency>

转换器是否已移至另一个程序包?我在哪里可以找到他们?

Were the converters moved to another package? Where can I find them?

推荐答案

版本4.2.1中的spring-context工件包含DateTimeConverters类,如在

The spring-context artifact in version 4.2.1 contains the DateTimeConverters class, as can be seen in the GitHub repo.

但是请注意,它是一个包类,它不是公共API的一部分,因此,该类在联机Javadoc中不可见.默认情况下,javadoc不会为程序包类生成HTML页面. 引用其引用(重点是我的) :

Note however that it is a package class, it is not part of the public API and that's why this class is not visible in the online Javadoc. javadoc, by default, does not generate HTML pages for package classes; quoting its reference (emphasis mine):

javadoc命令解析一组Java源文件中的声明和文档注释,并生成一组相应的HTML页面,这些页面描述(默认情况下)公共类和受保护类,嵌套类(但不包括匿名内部类) ),接口,构造函数,方法和字段.

如果您真的很好奇,可以通过查看它们的

And if you're really curious, you can see that Spring keeps the default values during Javadoc generation, by looking at their build.gradle.

如果您使用的是Java 8,Spring会使用以下XML声明自动注册这些转换器:

If you're using Java 8, Spring automatically registers those converters with the following XML declaration:

<mvc:annotation-driven conversion-service="conversionService"/>

<bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean" />

这篇关于找不到org.springframework.format.datetime.standard.DateTimeConverters的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆