Skip to content

Commit

Permalink
Remove mentions of Joda-Time support
Browse files Browse the repository at this point in the history
Since Joda-Time support was removed in Spring Framework 6.0, this commit
removes obsolete mentions of Joda-Time in the reference guide and Javadoc.

See spring-projectsgh-27426
Closes spring-projectsgh-33881
  • Loading branch information
sbrannen committed Nov 13, 2024
1 parent 0a5bd89 commit 4d792d0
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 67 deletions.
1 change: 0 additions & 1 deletion framework-docs/modules/ROOT/pages/web/webflux/config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ which customizes Jackson's default properties with the following ones:

It also automatically registers the following well-known modules if they are detected on the classpath:

* {jackson-github-org}/jackson-datatype-joda[`jackson-datatype-joda`]: Support for Joda-Time types.
* {jackson-github-org}/jackson-datatype-jsr310[`jackson-datatype-jsr310`]: Support for Java 8 Date and Time API types.
* {jackson-github-org}/jackson-datatype-jdk8[`jackson-datatype-jdk8`]: Support for other Java 8 types, such as `Optional`.
* {jackson-github-org}/jackson-module-kotlin[`jackson-module-kotlin`]: Support for Kotlin classes and data classes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ This builder customizes Jackson's default properties as follows:

It also automatically registers the following well-known modules if they are detected on the classpath:

* {jackson-github-org}/jackson-datatype-joda[jackson-datatype-joda]: Support for Joda-Time types.
* {jackson-github-org}/jackson-datatype-jsr310[jackson-datatype-jsr310]: Support for Java 8 Date and Time API types.
* {jackson-github-org}/jackson-datatype-jdk8[jackson-datatype-jdk8]: Support for other Java 8 types, such as `Optional`.
* {jackson-github-org}/jackson-module-kotlin[`jackson-module-kotlin`]: Support for Kotlin classes and data classes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@

/**
* The custom pattern to use to format the field or method parameter.
* <p>Defaults to empty String, indicating no custom pattern String has been
* <p>Defaults to an empty String, indicating no custom pattern String has been
* specified. Set this attribute when you wish to format your field or method
* parameter in accordance with a custom date time pattern not represented by
* a style or ISO format.
* <p>Note: This pattern follows the original {@link java.text.SimpleDateFormat} style,
* as also supported by Joda-Time, with strict parsing semantics towards overflows
* (e.g. rejecting a Feb 29 value for a non-leap-year). As a consequence, 'yy'
* <p>Note: This pattern follows the original {@link java.text.SimpleDateFormat}
* style, with strict parsing semantics towards overflows (for example, rejecting
* a {@code Feb 29} value for a non-leap-year). As a consequence, 'yy'
* characters indicate a year in the traditional style, not a "year-of-era" as in the
* {@link java.time.format.DateTimeFormatter} specification (i.e. 'yy' turns into 'uu'
* when going through a {@code DateTimeFormatter} with strict resolution mode).
Expand All @@ -129,7 +129,6 @@
* or {@link #style} attribute is always used for printing. For details on
* which time zone is used for fallback patterns, see the
* {@linkplain DateTimeFormat class-level documentation}.
* <p>Fallback patterns are not supported for Joda-Time value types.
* @since 5.3.5
*/
String[] fallbackPatterns() default {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ public void setStyle(int style) {
* <li>'F' = Full</li>
* <li>'-' = Omitted</li>
* </ul>
* This method mimics the styles supported by Joda-Time.
* @param stylePattern two characters from the set {"S", "M", "L", "F", "-"}
* @since 3.2
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -116,7 +116,7 @@ public void setDateTimeStyle(FormatStyle dateTimeStyle) {
}

/**
* Set the two characters to use to format date values, in Joda-Time style.
* Set the two characters to use to format date values.
* <p>The first character is used for the date style; the second is for
* the time style. Supported characters are:
* <ul>
Expand All @@ -126,9 +126,9 @@ public void setDateTimeStyle(FormatStyle dateTimeStyle) {
* <li>'F' = Full</li>
* <li>'-' = Omitted</li>
* </ul>
* <p>This method mimics the styles supported by Joda-Time. Note that
* JSR-310 natively favors {@link java.time.format.FormatStyle} as used for
* {@link #setDateStyle}, {@link #setTimeStyle} and {@link #setDateTimeStyle}.
* <p>Note that JSR-310 natively favors {@link java.time.format.FormatStyle}
* as used for {@link #setDateStyle}, {@link #setTimeStyle}, and
* {@link #setDateTimeStyle}.
* @param style two characters from the set {"S", "M", "L", "F", "-"}
*/
public void setStylePattern(String style) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ abstract class DateTimeFormatterUtils {
* @see ResolverStyle#STRICT
*/
static DateTimeFormatter createStrictDateTimeFormatter(String pattern) {
// Using strict resolution to align with Joda-Time and standard DateFormat behavior:
// otherwise, an overflow like e.g. Feb 29 for a non-leap-year wouldn't get rejected.
// Using strict resolution to align with standard DateFormat behavior:
// otherwise, an overflow like, for example, Feb 29 for a non-leap-year wouldn't get rejected.
// However, with strict resolution, a year digit needs to be specified as 'u'...
String patternToUse = StringUtils.replace(pattern, "yy", "uu");
return DateTimeFormatter.ofPattern(patternToUse).withResolverStyle(ResolverStyle.STRICT);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -97,7 +97,7 @@ public DefaultFormattingConversionService(

/**
* Add formatters appropriate for most environments: including number formatters,
* JSR-354 Money &amp; Currency formatters, JSR-310 Date-Time and/or Joda-Time formatters,
* JSR-354 Money &amp; Currency formatters, and JSR-310 Date-Time formatters,
* depending on the presence of the corresponding API on the classpath.
* @param formatterRegistry the service to register default formatters with
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,24 +32,19 @@
import org.springframework.util.StringValueResolver;

/**
* A factory providing convenient access to a {@code FormattingConversionService}
* configured with converters and formatters for common types such as numbers and
* datetimes.
* A factory providing convenient access to a {@link FormattingConversionService}
* configured with converters and formatters for common types such as numbers, dates,
* and times.
*
* <p>Additional converters and formatters can be registered declaratively through
* {@link #setConverters(Set)} and {@link #setFormatters(Set)}. Another option
* is to register converters and formatters in code by implementing the
* {@link FormatterRegistrar} interface. You can then configure provide the set
* of registrars to use through {@link #setFormatterRegistrars(Set)}.
*
* <p>A good example for registering converters and formatters in code is
* {@code JodaTimeFormatterRegistrar}, which registers a number of
* date-related formatters and converters. For a more detailed list of cases
* see {@link #setFormatterRegistrars(Set)}
* {@link FormatterRegistrar} interface. You can then provide the set of registrars
* to use through {@link #setFormatterRegistrars(Set)}.
*
* <p>Like all {@code FactoryBean} implementations, this class is suitable for
* use when configuring a Spring application context using Spring {@code <beans>}
* XML. When configuring the container with
* XML configuration files. When configuring the container with
* {@link org.springframework.context.annotation.Configuration @Configuration}
* classes, simply instantiate, configure and return the appropriate
* {@code FormattingConversionService} object from a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ else if (obj instanceof Number number) {
}
}

// Corresponding SQL types for JSR-310 / Joda-Time types, left up
// to the caller to convert them (e.g. through a ConversionService).
// Corresponding SQL types for JSR-310, left up to the caller to convert
// them (for example, through a ConversionService).
String typeName = requiredType.getSimpleName();
return switch (typeName) {
case "LocalDate" -> rs.getDate(index);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -214,7 +214,7 @@ public Jackson2ObjectMapperBuilder simpleDateFormat(String format) {

/**
* Override the default {@link Locale} to use for formatting.
* Default value used is {@link Locale#getDefault()}.
* <p>Default value used is {@link Locale#getDefault()}.
* @since 4.1.5
*/
public Jackson2ObjectMapperBuilder locale(Locale locale) {
Expand All @@ -224,7 +224,7 @@ public Jackson2ObjectMapperBuilder locale(Locale locale) {

/**
* Override the default {@link Locale} to use for formatting.
* Default value used is {@link Locale#getDefault()}.
* <p>Default value used is {@link Locale#getDefault()}.
* @param localeString the locale ID as a String representation
* @since 4.1.5
*/
Expand All @@ -235,7 +235,7 @@ public Jackson2ObjectMapperBuilder locale(String localeString) {

/**
* Override the default {@link TimeZone} to use for formatting.
* Default value used is UTC (NOT local timezone).
* <p>Default value used is UTC (NOT local timezone).
* @since 4.1.5
*/
public Jackson2ObjectMapperBuilder timeZone(TimeZone timeZone) {
Expand All @@ -245,7 +245,7 @@ public Jackson2ObjectMapperBuilder timeZone(TimeZone timeZone) {

/**
* Override the default {@link TimeZone} to use for formatting.
* Default value used is UTC (NOT local timezone).
* <p>Default value used is UTC (NOT local timezone).
* @param timeZoneString the zone ID as a String representation
* @since 4.1.5
*/
Expand All @@ -265,7 +265,7 @@ public Jackson2ObjectMapperBuilder annotationIntrospector(AnnotationIntrospector
/**
* Alternative to {@link #annotationIntrospector(AnnotationIntrospector)}
* that allows combining with rather than replacing the currently set
* introspector, e.g. via
* introspector &mdash; for example, via
* {@link AnnotationIntrospectorPair#pair(AnnotationIntrospector, AnnotationIntrospector)}.
* @param pairingFunction a function to apply to the currently set
* introspector (possibly {@code null}); the result of the function becomes
Expand Down Expand Up @@ -525,10 +525,10 @@ public Jackson2ObjectMapperBuilder featuresToDisable(Object... featuresToDisable

/**
* Specify the modules to be registered with the {@link ObjectMapper}.
* <p>Multiple invocations are not additive, the last one defines the modules to
* <p>Multiple invocations are not additive; the last one defines the modules to
* register.
* <p>Note: If this is set, no finding of modules is going to happen - not by
* Jackson, and not by Spring either (see {@link #findModulesViaServiceLoader}).
* <p>Note: If this is set, autodetection of modules will not occur &mdash; not
* by Jackson, and not by Spring either (see {@link #findModulesViaServiceLoader}).
* As a consequence, specifying an empty list here will suppress any kind of
* module detection.
* <p>Specify either this or {@link #modulesToInstall}, not both.
Expand Down Expand Up @@ -571,11 +571,10 @@ public Jackson2ObjectMapperBuilder modules(Consumer<List<Module>> consumer) {

/**
* Specify one or more modules to be registered with the {@link ObjectMapper}.
* <p>Multiple invocations are not additive, the last one defines the modules
* <p>Multiple invocations are not additive; the last one defines the modules
* to register.
* <p>Modules specified here will be registered after
* Spring's autodetection of JSR-310 and Joda-Time, or Jackson's
* finding of modules (see {@link #findModulesViaServiceLoader}),
* <p>Modules specified here will be registered after Spring's autodetection of
* JSR-310, or Jackson's finding of modules (see {@link #findModulesViaServiceLoader}),
* allowing to eventually override their configuration.
* <p>Specify either this or {@link #modules(Module...)}, not both.
* @since 4.1.5
Expand Down Expand Up @@ -605,13 +604,11 @@ public Jackson2ObjectMapperBuilder modulesToInstall(Consumer<List<Module>> consu
}

/**
* Specify one or more modules by class to be registered with
* the {@link ObjectMapper}.
* <p>Multiple invocations are not additive, the last one defines the modules
* Specify one or more modules by class to be registered with the {@link ObjectMapper}.
* <p>Multiple invocations are not additive; the last one defines the modules
* to register.
* <p>Modules specified here will be registered after
* Spring's autodetection of JSR-310 and Joda-Time, or Jackson's
* finding of modules (see {@link #findModulesViaServiceLoader}),
* <p>Modules specified here will be registered after Spring's autodetection of
* JSR-310, or Jackson's finding of modules (see {@link #findModulesViaServiceLoader}),
* allowing to eventually override their configuration.
* <p>Specify either this or {@link #modules(Module...)}, not both.
* @see #modulesToInstall(Module...)
Expand All @@ -630,8 +627,7 @@ public final Jackson2ObjectMapperBuilder modulesToInstall(Class<? extends Module
* Set whether to let Jackson find available modules via the JDK ServiceLoader,
* based on META-INF metadata in the classpath.
* <p>If this mode is not set, Spring's Jackson2ObjectMapperBuilder itself
* will try to find the JSR-310 and Joda-Time support modules on the classpath -
* provided that Java 8 and Joda-Time themselves are available, respectively.
* will try to find the JSR-310 support module on the classpath.
* @see com.fasterxml.jackson.databind.ObjectMapper#findModules()
*/
public Jackson2ObjectMapperBuilder findModulesViaServiceLoader(boolean findModules) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -391,11 +391,10 @@ public void setModules(List<Module> modules) {
}

/**
* Specify one or more modules by class (or class name in XML)
* to be registered with the {@link ObjectMapper}.
* <p>Modules specified here will be registered after
* Spring's autodetection of JSR-310 and Joda-Time, or Jackson's
* finding of modules (see {@link #setFindModulesViaServiceLoader}),
* Specify one or more modules by class (or class name in XML) to be registered
* with the {@link ObjectMapper}.
* <p>Modules specified here will be registered after Spring's autodetection of
* JSR-310, or Jackson's finding of modules (see {@link #setFindModulesViaServiceLoader}),
* allowing to eventually override their configuration.
* <p>Specify either this or {@link #setModules}, not both.
* @since 4.0.1
Expand All @@ -410,8 +409,7 @@ public final void setModulesToInstall(Class<? extends Module>... modules) {
* Set whether to let Jackson find available modules via the JDK ServiceLoader,
* based on META-INF metadata in the classpath.
* <p>If this mode is not set, Spring's Jackson2ObjectMapperFactoryBean itself
* will try to find the JSR-310 and Joda-Time support modules on the classpath -
* provided that Java 8 and Joda-Time themselves are available, respectively.
* will try to find the JSR-310 support module on the classpath.
* @since 4.0.1
* @see com.fasterxml.jackson.databind.ObjectMapper#findModules()
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -511,7 +511,7 @@ private RuntimeBeanReference registerMessageConverter(
RootBeanDefinition resolverDef = new RootBeanDefinition(DefaultContentTypeResolver.class);
resolverDef.getPropertyValues().add("defaultMimeType", MimeTypeUtils.APPLICATION_JSON);
jacksonConverterDef.getPropertyValues().add("contentTypeResolver", resolverDef);
// Use Jackson factory in order to have JSR-310 and Joda-Time modules registered automatically
// Use Jackson factory in order to have well known modules registered automatically
GenericBeanDefinition jacksonFactoryDef = new GenericBeanDefinition();
jacksonFactoryDef.setBeanClass(Jackson2ObjectMapperFactoryBean.class);
jacksonFactoryDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public WebSocketMessageBrokerStats webSocketMessageBrokerStats(
@Override
protected MappingJackson2MessageConverter createJacksonConverter() {
MappingJackson2MessageConverter messageConverter = super.createJacksonConverter();
// Use Jackson builder in order to have JSR-310 and Joda-Time modules registered automatically
// Use Jackson builder in order to have well-known modules registered automatically.
Jackson2ObjectMapperBuilder builder = Jackson2ObjectMapperBuilder.json();
ApplicationContext applicationContext = getApplicationContext();
if (applicationContext != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,9 +37,6 @@
* <li>{@link DeserializationFeature#FAIL_ON_UNKNOWN_PROPERTIES} is disabled</li>
* </ul>
*
* <p>Note that Jackson's JSR-310 and Joda-Time support modules will be registered automatically
* when available (and when Java 8 and Joda-Time themselves are available, respectively).
*
* @author Rossen Stoyanchev
* @since 4.0
*/
Expand Down

0 comments on commit 4d792d0

Please sign in to comment.