找不到 org.springframework.format.datetime.standard.DateTimeConverters
Unable to find org.springframework.format.datetime.standard.DateTimeConverters
有一个 Spring class、org.springframework.format.datetime.standard.DateTimeConverters
,其中包含一些有用的转换器,但我找不到。它记录在 4.1.0.RC1_to_4.1.0.RC2 javadoc but not in the 4.1.0.RELEASE 中。请注意 javadoc 中的 @UsesJava8
注释。当然,我使用 Java 8 因为我需要在新类型之间进行转换。
class 的源代码在 GitHub 中带有 4.1 标签,我使用以下 xml 通过 Maven 将项目添加到我的 pom.xml。
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.1.RELEASE</version>
</dependency>
转换器是否转移到另一个包?我在哪里可以找到它们?
版本 4.2.1 中的 spring-context
工件包含 DateTimeConverters
class,如 GitHub repo.
中所示
但是请注意,它是一个包 class,它不是 public API 的一部分,这就是为什么这个 class 在在线 Java医生。 javadoc
,默认情况下,不会为包 classes 生成 HTML 页; quoting its reference(强调我的):
The javadoc command parses the declarations and documentation comments in a set of Java source files and produces a corresponding set of HTML pages that describe (by default) the public and protected classes, nested classes (but not anonymous inner classes), interfaces, constructors, methods, and fields.
如果你真的很好奇,你可以看到 Spring 在 Javadoc 生成期间保持默认值,通过查看他们的 build.gradle
.
如果您使用的是 Java 8,Spring 会使用以下 XML 声明自动注册这些转换器:
<mvc:annotation-driven conversion-service="conversionService"/>
<bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean" />
有一个 Spring class、org.springframework.format.datetime.standard.DateTimeConverters
,其中包含一些有用的转换器,但我找不到。它记录在 4.1.0.RC1_to_4.1.0.RC2 javadoc but not in the 4.1.0.RELEASE 中。请注意 javadoc 中的 @UsesJava8
注释。当然,我使用 Java 8 因为我需要在新类型之间进行转换。
class 的源代码在 GitHub 中带有 4.1 标签,我使用以下 xml 通过 Maven 将项目添加到我的 pom.xml。
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.1.RELEASE</version>
</dependency>
转换器是否转移到另一个包?我在哪里可以找到它们?
版本 4.2.1 中的 spring-context
工件包含 DateTimeConverters
class,如 GitHub repo.
但是请注意,它是一个包 class,它不是 public API 的一部分,这就是为什么这个 class 在在线 Java医生。 javadoc
,默认情况下,不会为包 classes 生成 HTML 页; quoting its reference(强调我的):
The javadoc command parses the declarations and documentation comments in a set of Java source files and produces a corresponding set of HTML pages that describe (by default) the public and protected classes, nested classes (but not anonymous inner classes), interfaces, constructors, methods, and fields.
如果你真的很好奇,你可以看到 Spring 在 Javadoc 生成期间保持默认值,通过查看他们的 build.gradle
.
如果您使用的是 Java 8,Spring 会使用以下 XML 声明自动注册这些转换器:
<mvc:annotation-driven conversion-service="conversionService"/>
<bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean" />