Merge branch '6.1.x'
This commit is contained in:
commit
d92c57f7a5
|
@ -349,7 +349,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.
|
||||
|
|
|
@ -35,7 +35,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.
|
||||
|
|
|
@ -101,13 +101,13 @@ public @interface DateTimeFormat {
|
|||
|
||||
/**
|
||||
* 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
|
||||
* (for example, 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).
|
||||
|
@ -129,7 +129,6 @@ public @interface DateTimeFormat {
|
|||
* 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 {};
|
||||
|
|
|
@ -181,7 +181,6 @@ public class DateFormatter implements Formatter<Date> {
|
|||
* <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
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
|
@ -116,7 +116,7 @@ public class DateTimeFormatterFactory {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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>
|
||||
|
@ -126,9 +126,9 @@ public class DateTimeFormatterFactory {
|
|||
* <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) {
|
||||
|
|
|
@ -38,7 +38,7 @@ abstract class DateTimeFormatterUtils {
|
|||
* @see ResolverStyle#STRICT
|
||||
*/
|
||||
static DateTimeFormatter createStrictDateTimeFormatter(String pattern) {
|
||||
// Using strict resolution to align with Joda-Time and standard DateFormat behavior:
|
||||
// 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");
|
||||
|
|
|
@ -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.
|
||||
|
@ -97,7 +97,7 @@ public class DefaultFormattingConversionService extends FormattingConversionServ
|
|||
|
||||
/**
|
||||
* Add formatters appropriate for most environments: including number formatters,
|
||||
* JSR-354 Money & Currency formatters, JSR-310 Date-Time and/or Joda-Time formatters,
|
||||
* JSR-354 Money & 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
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
|
@ -32,24 +32,19 @@ import org.springframework.lang.Nullable;
|
|||
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
|
||||
|
|
|
@ -239,8 +239,8 @@ public abstract class JdbcUtils {
|
|||
}
|
||||
}
|
||||
|
||||
// Corresponding SQL types for JSR-310 / Joda-Time types, left up
|
||||
// to the caller to convert them (for example, 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);
|
||||
|
|
|
@ -216,7 +216,7 @@ public class Jackson2ObjectMapperBuilder {
|
|||
|
||||
/**
|
||||
* 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) {
|
||||
|
@ -226,7 +226,7 @@ public class Jackson2ObjectMapperBuilder {
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
@ -237,7 +237,7 @@ public class Jackson2ObjectMapperBuilder {
|
|||
|
||||
/**
|
||||
* 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) {
|
||||
|
@ -247,7 +247,7 @@ public class Jackson2ObjectMapperBuilder {
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
@ -527,10 +527,10 @@ public class Jackson2ObjectMapperBuilder {
|
|||
|
||||
/**
|
||||
* 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 — 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.
|
||||
|
@ -573,11 +573,10 @@ public class Jackson2ObjectMapperBuilder {
|
|||
|
||||
/**
|
||||
* 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
|
||||
|
@ -607,13 +606,11 @@ public class Jackson2ObjectMapperBuilder {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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...)
|
||||
|
@ -632,8 +629,7 @@ public class Jackson2ObjectMapperBuilder {
|
|||
* 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) {
|
||||
|
|
|
@ -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.
|
||||
|
@ -391,11 +391,10 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper
|
|||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -410,8 +409,7 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper
|
|||
* 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()
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
|
@ -511,7 +511,7 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
|
|||
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);
|
||||
|
|
|
@ -165,7 +165,7 @@ public abstract class WebSocketMessageBrokerConfigurationSupport extends Abstrac
|
|||
@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) {
|
||||
|
|
|
@ -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.
|
||||
|
@ -37,9 +37,6 @@ import org.springframework.util.Assert;
|
|||
* <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
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue