Commit Graph

1464 Commits

Author SHA1 Message Date
Mihai Dumitrescu
325edbec7d Add additional tests for MultiValueMap
See gh-25140
See gh-25160
2023-08-25 11:27:52 +02:00
Stephane Nicoll
86e02a47fb Polish 2023-08-24 09:04:14 +02:00
陈其苗
e7071c329a Add a unit test for getMostSpecificMethod of ClassUtils
See gh-24633
2023-08-23 20:45:02 +02:00
Stephane Nicoll
a20a74817e Polish "Add support for converting String to Pattern"
See gh-24311
2023-08-23 18:13:41 +02:00
Valery Yatsynovich
06f6b45248 Add support for converting String to Pattern
See gh-24311
2023-08-23 18:13:41 +02:00
Stephane Nicoll
6e141cc23a Polish "Add a composite for TaskDecorator"
See gh-23692
2023-08-23 16:02:54 +02:00
Tadaya Tsuyukubo
5f581a9a68 Add a composite for TaskDecorator
See gh-23692
2023-08-23 16:02:41 +02:00
Stephane Nicoll
f95a1f49df Polish "Add Basic Authorization for UrlResource"
See gh-1822
2023-08-22 16:38:00 +02:00
Sam Brannen
74130d007b Ensure direct @PropertySource annotations override meta-annotations
Prior to this commit, there was an issue with the semantics of property
source overrides. Specifically, a @PropertySource annotation present as
a meta-annotation on a @Configuration class was registered with higher
precedence than a @PropertySource annotation declared closer to (or
directly on) the @Configuration class. Consequently, there was no way
for a "local" @PropertySource annotation to override properties
registered via @PropertySource as a meta-annotation.

This commit addresses this issue by introducing a new overloaded
getMergedRepeatableAnnotationAttributes() variant in
AnnotatedTypeMetadata that allows the caller to supply a
sortByReversedMetaDistance flag. When set to `true`, the annotation
search results will be sorted in reversed order based on each
annotation's meta distance, which effectively orders meta-annotations
before annotations that are declared directly on the underlying element.

ConfigurationClassParser and AnnotationConfigUtils have been updated to
use this new repeatable annotation search method for @PropertySource.

Closes gh-31074
2023-08-18 16:43:44 +02:00
Stephane Nicoll
9583d18896 Merge branch '6.0.x' 2023-08-18 15:39:49 +02:00
Stephane Nicoll
47b1a2bc55 Clarify usage of FilePatternResourceHintsRegistrar
This commit review the API using a builder to make it more clear what
the registrar does.

Closes gh-29161
2023-08-18 15:35:20 +02:00
Juergen Hoeller
20d27e4fb6 Merge branch '6.0.x' 2023-08-14 15:14:58 +02:00
Juergen Hoeller
389238f622 Add registerReactiveTypeOverride method to ReactiveAdapterRegistry
Closes gh-31047
2023-08-14 15:14:22 +02:00
Sam Brannen
bfeca4a0bf Polish contribution
See gh-30744
2023-08-13 17:03:12 +02:00
Adilson A
4979d8fded Increase code coverage in spring-core serializer package
Closes gh-30744
2023-08-13 16:26:02 +02:00
Sam Brannen
0b902f32f6 Support finding repeatable annotations in AnnotatedTypeMetadata
AnnotatedTypeMetadata has various methods for finding annotations;
however, prior to this commit it did not provide explicit support for
repeatable annotations.

Although it is possible to craft a search "query" for repeatable
annotations using the MergedAnnotations API via getAnnotations(), that
requires intimate knowledge of the MergedAnnotations API as well as the
structure of repeatable annotations.

Furthermore, the bugs reported in gh-30941 result from the fact that
AnnotationConfigUtils attempts to use the existing functionality in
AnnotatedTypeMetadata to find repeatable annotations without success.

This commit introduces a getMergedRepeatableAnnotationAttributes()
method in AnnotatedTypeMetadata that provides dedicated support for
finding merged repeatable annotation attributes with full @AliasFor
semantics.

Closes gh-31041
2023-08-12 18:49:08 +02:00
Sam Brannen
fb6c325cc0 Document @AliasFor support in AnnotatedTypeMetadata.getAnnotationAttributes()
The Javadoc for getAnnotationAttributes() states that it supports
"attribute overrides on composed annotations"; however, it actually
supports @AliasFor in general, including attribute aliases within a
given annotation.

This commit updates the Javadoc and corresponding tests to reflect that.

Closes gh-31042
2023-08-12 18:09:37 +02:00
Sam Brannen
c52bfc0586 Update test names to reflect status quo
AnnotationMetadataReadingVisitor was replaced by
SimpleAnnotationMetadata in Spring Framework 5.2.
2023-08-12 18:09:37 +02:00
Juergen Hoeller
3b093754c8 Rename getLastTaskInfo to lastTaskInfo (aligned with currentTaskName)
See gh-25803
2023-08-08 09:41:00 +02:00
Juergen Hoeller
8e16e5ea35 Revise StopWatch for flexible time units in nanosecond precision
Closes gh-25803
2023-08-08 01:48:58 +02:00
Sam Brannen
526fc391ee Use Class#componentType() for consistency with arrayType()
Java 12 introduced java.lang.Class#componentType() as a shortcut for
getComponentType().

Since we started using arrayType() in fe5560400c, this commit switches
to componentType() for consistent API usage style.
2023-08-07 12:43:40 +03:00
Juergen Hoeller
6e5af9dccb Polishing 2023-08-06 14:25:39 +02:00
Juergen Hoeller
40b33bca59 Compatibility with Flow-based SmallRye Mutiny 2 at runtime
Includes simple Flow.Publisher bridge without Reactor.

Closes gh-31000
2023-08-06 14:04:24 +02:00
Sam Brannen
14911fb32f Merge branch '6.0.x' 2023-08-05 10:28:32 +03:00
Sam Brannen
4a81814dbb Check exception cause for @PropertySource(ignoreResourceNotFound) support
Prior to this commit, the ignoreResourceNotFound flag in
@PropertySource was ignored by PropertySourceProcessor if a
PropertySourceFactory threw an exception which wrapped an exception
that would otherwise be ignored -- for example, a FileNotFoundException.

To address this issue, this commit updates PropertySourceFactory so
that it catches RuntimeException and IOException and then checks if the
exception or its cause is an "ignorable" exception in terms of
ignoreResourceNotFound semantics.

Closes gh-22276
2023-08-05 10:19:43 +03:00
Sam Brannen
170d6bfdad Clean up warnings in tests 2023-07-31 16:17:48 +03:00
Sam Brannen
2f7046f572 Deprecate org.springframework.core.Constants utility
Closes gh-30851
2023-07-31 16:08:47 +03:00
Juergen Hoeller
3a278cc66d Polishing 2023-07-15 14:20:00 +02:00
Sam Brannen
a34f9fa66c Update copyright headers 2023-07-15 13:10:46 +02:00
Juergen Hoeller
351a200747 Merge branch '6.0.x' 2023-07-15 14:21:05 +02:00
Sam Brannen
5ce8ffd197 Merge branch '6.0.x' 2023-07-15 13:11:03 +02:00
Juergen Hoeller
064cd3b7af Merge branch '6.0.x'
# Conflicts:
#	gradle.properties
#	spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java
2023-07-14 12:18:41 +02:00
Juergen Hoeller
75f5dac16b Polishing 2023-07-14 12:16:37 +02:00
Sam Brannen
16b9640af2 Merge branch '6.0.x' 2023-07-12 11:50:11 +02:00
Sam Brannen
68f2b0ca59 Rely on auto-boxing in tests 2023-07-12 11:49:02 +02:00
Sam Brannen
826776f321 Improve assertions in DefaultConversionServiceTests
Specifically, we now check the actual type of a converted collection in
various assertions to ensure that converters adhere to their contracts.
2023-07-06 14:01:26 +02:00
Juergen Hoeller
b7b9f2cb6b Expand tests for array to Collection/Set/List interface
See gh-28048
2023-07-05 20:15:10 +02:00
Sam Brannen
b76664e757 Support arrays, collections, & maps in ObjectUtils.nullSafeConciseToString()
Prior to this commit, there was no explicit support for arrays,
collections, and maps in nullSafeConciseToString(). This lead to string
representations such as the following, regardless of whether the array,
collection, or map was empty.

- char[]@1623b78d
- java.util.ImmutableCollections$List12@74fe5c40
- java.util.ImmutableCollections$MapN@10e31a9a

This commit introduces explicit support for arrays, collections, and
maps in nullSafeConciseToString(), which results in the following
empty/non-empty string representations.

- array: {} / {...}
- collection: [] / [...]
- map: {} / {...}

The reason a string representation of an array uses "{}" instead of
"[]" (like in Arrays.toString(...)) is that
ObjectUtils.nullSafeToString(<array>) already follows that convention,
and the implementation of nullSafeConciseToString() aligns with that
for the sake of consistency.

Closes gh-30810
2023-07-05 17:01:01 +02:00
Juergen Hoeller
80a20488fd Make File/Path tests pass on Windows
See gh-30806
2023-07-04 16:52:39 +02:00
Sam Brannen
3ef1b7d83c Extend supported types in ObjectUtils.nullSafeConciseToString()
This commit extends the list of explicitly supported types in
ObjectUtils.nullSafeConciseToString() with the following.

- Optional
- File
- Path
- InetAddress
- Charset
- Currency
- TimeZone
- ZoneId
- Pattern

Closes gh-30805
2023-07-04 13:27:47 +02:00
Sam Brannen
08bce69d3d Add tests for status quo in ObjectUtils.nullSafeConciseToString() 2023-07-04 13:15:56 +02:00
Sam Brannen
c95426a616 Polishing 2023-06-30 13:55:34 +02:00
Juergen Hoeller
0c39fff831 Polishing 2023-06-29 18:04:08 +02:00
Juergen Hoeller
6b1fbc9fe1 Revise ResolvableType equality
ResolvableTypes are only considered equal if of the very same class now.
As a consequence, a forRawClass result is not equal to forClass anymore.
The new equalsType method is available for plain type equality checks.

Closes gh-28608
Closes gh-27748
2023-07-09 12:35:37 +02:00
Sam Brannen
0bf85af8e9 Merge branch '6.0.x'
# Conflicts:
#	framework-docs/modules/ROOT/pages/integration/observability.adoc
#	spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java
2023-07-06 14:11:24 +02:00
Juergen Hoeller
0c8d3e70cf Prefer ArrayList for Collection when source is an array
Closes gh-28048
2023-07-05 20:23:17 +02:00
Juergen Hoeller
47e631d5ff Merge branch '6.0.x' 2023-07-05 20:15:53 +02:00
Sam Brannen
e86003b692 Merge branch '6.0.x' 2023-07-05 17:02:35 +02:00
Juergen Hoeller
420255373d Merge branch '6.0.x' 2023-07-04 16:53:17 +02:00
Sam Brannen
7156ea016e Merge branch '6.0.x'
# Conflicts:
#	spring-core/src/main/java/org/springframework/util/ObjectUtils.java
2023-07-04 13:44:19 +02:00