Deprecate Joda time support

This commit deprecates the Joda time support and schedules it for
removal in 6.0.

Closes gh-25736
This commit is contained in:
Brian Clozel
2020-09-08 13:12:53 +02:00
parent 7dbb40ffa0
commit 078543ce67
15 changed files with 34 additions and 12 deletions

View File

@@ -42,7 +42,9 @@ import org.springframework.util.StringUtils;
* @see #setStyle
* @see #setIso
* @see DateTimeFormatterFactoryBean
* @deprecated as of 5.3.0, scheduled for removal in 6.0.
*/
@Deprecated
public class DateTimeFormatterFactory {
@Nullable

View File

@@ -33,7 +33,9 @@ import org.springframework.lang.Nullable;
* @see #setIso
* @see #setStyle
* @see DateTimeFormatterFactory
* @deprecated as of 5.3.0, scheduled for removal in 6.0.
*/
@Deprecated
public class DateTimeFormatterFactoryBean extends DateTimeFormatterFactory
implements FactoryBean<DateTimeFormatter>, InitializingBean {

View File

@@ -29,7 +29,9 @@ import org.springframework.format.Parser;
*
* @author Keith Donald
* @since 3.0
* @deprecated as of 5.3.0, scheduled for removal in 6.0.
*/
@Deprecated
public final class DateTimeParser implements Parser<DateTime> {
private final DateTimeFormatter formatter;

View File

@@ -45,7 +45,9 @@ import org.springframework.util.StringUtils;
* @author Juergen Hoeller
* @since 3.0
* @see DateTimeFormat
* @deprecated as of 5.3.0, scheduled for removal in 6.0.
*/
@Deprecated
public class JodaDateTimeFormatAnnotationFormatterFactory extends EmbeddedValueResolutionSupport
implements AnnotationFormatterFactory<DateTimeFormat> {

View File

@@ -36,7 +36,9 @@ import org.springframework.lang.Nullable;
* @author Keith Donald
* @since 3.0
* @see JodaTimeContextHolder
* @deprecated as of 5.3.0, scheduled for removal in 6.0.
*/
@Deprecated
public class JodaTimeContext {
@Nullable

View File

@@ -31,7 +31,9 @@ import org.springframework.lang.Nullable;
* @author Juergen Hoeller
* @since 3.0
* @see org.springframework.context.i18n.LocaleContextHolder
* @deprecated as of 5.3.0, scheduled for removal in 6.0.
*/
@Deprecated
public final class JodaTimeContextHolder {
private static final ThreadLocal<JodaTimeContext> jodaTimeContextHolder =

View File

@@ -55,7 +55,9 @@ import org.springframework.format.annotation.DateTimeFormat.ISO;
* @see FormatterRegistrar#registerFormatters
* @see org.springframework.format.datetime.DateFormatterRegistrar
* @see DateTimeFormatterFactoryBean
* @deprecated as of 5.3.0, scheduled for removal in 6.0.
*/
@Deprecated
public class JodaTimeFormatterRegistrar implements FormatterRegistrar {
private enum Type {DATE, TIME, DATE_TIME}

View File

@@ -30,7 +30,9 @@ import org.springframework.format.Parser;
*
* @author Juergen Hoeller
* @since 4.0
* @deprecated as of 5.3.0, scheduled for removal in 6.0.
*/
@Deprecated
public final class LocalDateParser implements Parser<LocalDate> {
private final DateTimeFormatter formatter;

View File

@@ -30,7 +30,9 @@ import org.springframework.format.Parser;
*
* @author Juergen Hoeller
* @since 4.0
* @deprecated as of 5.3.0, scheduled for removal in 6.0.
*/
@Deprecated
public final class LocalDateTimeParser implements Parser<LocalDateTime> {
private final DateTimeFormatter formatter;

View File

@@ -30,7 +30,9 @@ import org.springframework.format.Parser;
*
* @author Juergen Hoeller
* @since 4.0
* @deprecated as of 5.3.0, scheduled for removal in 6.0.
*/
@Deprecated
public final class LocalTimeParser implements Parser<LocalTime> {
private final DateTimeFormatter formatter;

View File

@@ -27,7 +27,9 @@ import org.springframework.format.Printer;
*
* @author Keith Donald
* @since 3.0
* @deprecated as of 5.3.0, scheduled for removal in 6.0.
*/
@Deprecated
public final class MillisecondInstantPrinter implements Printer<Long> {
private final DateTimeFormatter formatter;

View File

@@ -28,7 +28,9 @@ import org.springframework.format.Printer;
*
* @author Keith Donald
* @since 3.0
* @deprecated as of 5.3.0, scheduled for removal in 6.0.
*/
@Deprecated
public final class ReadableInstantPrinter implements Printer<ReadableInstant> {
private final DateTimeFormatter formatter;

View File

@@ -28,7 +28,9 @@ import org.springframework.format.Printer;
*
* @author Keith Donald
* @since 3.0
* @deprecated as of 5.3.0, scheduled for removal in 6.0.
*/
@Deprecated
public final class ReadablePartialPrinter implements Printer<ReadablePartial> {
private final DateTimeFormatter formatter;

View File

@@ -19,7 +19,6 @@ package org.springframework.format.support;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.format.FormatterRegistry;
import org.springframework.format.datetime.DateFormatterRegistrar;
import org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar;
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
import org.springframework.format.number.NumberFormatAnnotationFormatterFactory;
import org.springframework.format.number.money.CurrencyUnitFormatter;
@@ -57,7 +56,6 @@ public class DefaultFormattingConversionService extends FormattingConversionServ
jodaTimePresent = ClassUtils.isPresent("org.joda.time.YearMonth", classLoader);
}
/**
* Create a new {@code DefaultFormattingConversionService} with the set of
* {@linkplain DefaultConversionService#addDefaultConverters default converters} and
@@ -106,6 +104,7 @@ public class DefaultFormattingConversionService extends FormattingConversionServ
* depending on the presence of the corresponding API on the classpath.
* @param formatterRegistry the service to register default formatters with
*/
@SuppressWarnings("deprecation")
public static void addDefaultFormatters(FormatterRegistry formatterRegistry) {
// Default handling of number values
formatterRegistry.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory());
@@ -124,7 +123,7 @@ public class DefaultFormattingConversionService extends FormattingConversionServ
if (jodaTimePresent) {
// handles Joda-specific types as well as Date, Calendar, Long
new JodaTimeFormatterRegistrar().registerFormatters(formatterRegistry);
new org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar().registerFormatters(formatterRegistry);
}
else {
// regular DateFormat-based Date, Calendar, Long converters