Commit Graph

31795 Commits

Author SHA1 Message Date
Sébastien Deleuze
cf90beec0a Refine null-safety in the spring-core module
Closes gh-34150
2024-12-24 16:46:00 +01:00
Sébastien Deleuze
fbc759077c Refine null-safety in the spring-jdbc module
Closes gh-34147
2024-12-24 16:17:24 +01:00
Simon Baslé
0c6f5d7d29 HttpHeaders are no longer a MultiValueMap
This change removes the `MultiValueMap` nature of `HttpHeaders`, since
it inherits APIs that do not align well with underlying server
implementations. Notably, methods that allows to iterate over the whole
collection of headers are susceptible to artificially introduced
duplicates when multiple casings are used for a given header, depending
on the underlying implementation.

This change includes a dedicated key set implementation to support
iterator-based removal, and either keeps map method implementations that
are relevant or introduces header-focused methods that have a similar
responsibility (like `hasHeaderValues(String, List)` and
`containsHeaderValue(String, String)`).

In order to nudge users away from using an HttpHeaders as a Map, the
`asSingleValueMap` view is deprecated. In order to offer an escape
hatch to users that do make use of the `MultiValueMap` API, a similar
`asMultiValueMap` view is introduced but is immediately marked as
deprecated.

This change also adds map-like but header-focused assertions to
`HttpHeadersAssert`, since it cannot extend `AbstractMapAssert` anymore.

Closes gh-33913
2024-12-24 14:43:51 +01:00
Sébastien Deleuze
1e0ef99b0c Leverage @NullMarked instead of package configuration
This commit replaces NullAway package configuration by package-level
`@NullMarked` detection by configuring `NullAway:AnnotatedPackages` to
an empty string.

NullAway configuration should be refined to use a proper flag instead
once uber/NullAway#574 is fixed.

See gh-28797
2024-12-23 17:14:29 +01:00
Sébastien Deleuze
528578d138 Merge branch '6.2.x' 2024-12-23 15:34:57 +01:00
Sébastien Deleuze
69b74d7645 Fix NullPointerException in HttpComponentsClientHttpResponse
Closes gh-34132
2024-12-23 15:34:04 +01:00
Stéphane Nicoll
950d0b5164 Merge branch '6.2.x' 2024-12-23 12:31:31 +01:00
Stéphane Nicoll
5ce5647d09 Restore support of exact match property
This commit fixes a regression in property placeholder resolution where
the original key was no longer considered for an exact match before
processing the placeholder itself.

By default, property resolution uses ':' as the separator between the
key and the fallback value.

Consider a request to resolve ${prefix://service}. Previously,
placeholder resolution would first attempt to resolve the raw text, that
is 'prefix://service', before attempting to resolve the 'prefix' key and
then use '//service' if the key did not resolve.

This commit restores that behaviour purely for backward compatible
reason.

Closes gh-34124
2024-12-23 12:19:45 +01:00
Sébastien Deleuze
bccd9e9f11 Merge branch '6.2.x' 2024-12-23 11:15:08 +01:00
Tran Ngoc Nhan
ebae02a92b Fix broken links in the web reference documentation
Closes gh-34115
2024-12-23 11:14:40 +01:00
Sam Brannen
bf06d74879 Merge branch '6.2.x' 2024-12-21 16:03:43 +01:00
Sam Brannen
99cb6ba0a7 Upgrade to Gradle 8.12 2024-12-21 16:02:15 +01:00
Sam Brannen
2baf70768d Upgrade to AssertJ 3.27 2024-12-21 15:49:31 +01:00
Sam Brannen
5b8e436c98 Merge branch '6.2.x' 2024-12-21 15:31:29 +01:00
Sam Brannen
724700d708 Polishing 2024-12-21 15:31:01 +01:00
Andreas Kruck
83ba7e69ec Fix minor typo in reference documentation for Kotlin annotations
Closes gh-34134
2024-12-21 15:28:33 +01:00
rstoyanchev
373763723e Deprecate use of PathMatcher and UrlPathHelper in web
Closes gh-34018
2024-12-19 15:59:41 +00:00
rstoyanchev
41a9db376d Deprecate pathExtension routing predicates
Closes gh-34103
2024-12-19 15:59:18 +00:00
Sam Brannen
62d9600cdd Clean up warnings in Gradle build 2024-12-19 14:48:33 +01:00
Sébastien Deleuze
ef06bf4e74 Refine null-safety migration documentation
See gh-28797
2024-12-19 11:38:26 +01:00
Sébastien Deleuze
6d2d10cffe Update null-safety documentation
This commit documents using JSpecify instead of the now deprecated
Spring null-safety annotations.

Closes gh-28797
2024-12-19 11:07:33 +01:00
Sébastien Deleuze
b3586560c1 Add support for AnnotatedType in MethodParameter.hasNullableAnnotation
This commit adds support for detecting annotated types.

See gh-28797
2024-12-19 11:07:33 +01:00
Sébastien Deleuze
61545fabfc Deprecate Spring nullability annotations
JSpecify annotations should be used instead.

See gh-28797
2024-12-19 11:07:33 +01:00
Sébastien Deleuze
0e85d950b3 Remove unneeded @NonNull annotations
See gh-28797
2024-12-19 11:07:33 +01:00
Sébastien Deleuze
bc5d771a06 Switch to JSpecify annotations
This commit updates the whole Spring Framework codebase to use JSpecify
annotations instead of Spring null-safety annotations with JSR 305
semantics.

JSpecify provides signficant enhancements such as properly defined
specifications, a canonical dependency with no split-package issue,
better tooling, better Kotlin integration and the capability to specify
generic type, array and varargs element null-safety. Generic type
null-safety is not defined by this commit yet and will be specified
later.

A key difference is that Spring null-safety annotations, following
JSR 305 semantics, apply to fields, parameters and return values,
while JSpecify annotations apply to type usages. That's why this
commit moves nullability annotations closer to the type for fields
and return values.

See gh-28797
2024-12-19 11:07:23 +01:00
Sam Brannen
fcb8aed03f Merge branch '6.2.x' 2024-12-18 18:04:19 +01:00
Sam Brannen
c1236a3340 Support varargs-only MethodHandle as SpEL function
Prior to this commit, if a MethodHandle was registered as a custom
function in the Spring Expression Language (SpEL) for a static method
that accepted only a variable argument list (for example,
`static String func(String... args)`), attempting to invoke the
registered function within a SpEL expression resulted in a
ClassCastException because the varargs array was unnecessarily wrapped
in an Object[].

This commit modifies the logic in FunctionReference's internal
executeFunctionViaMethodHandle() method to address that.

Closes gh-34109
2024-12-18 17:59:14 +01:00
rstoyanchev
4b9f1732f1 Remove remaining Spring MVC trailing slash matching
Closes gh-34036
2024-12-17 11:14:00 +00:00
rstoyanchev
2e6046a655 Remove trailing slash matching in PathPatternParser
See gh-34036
2024-12-17 11:14:00 +00:00
rstoyanchev
32db1a1680 Remove WebFlux trailing slash match
See gh-34036
2024-12-17 11:14:00 +00:00
Brian Clozel
4fd368b1af Deprecate mvc XML configuration namespace
This commit deprecates the `<mvc:*` XML configuration namespace for
configuring Spring MVC applications. This configuration model is lagging
behind in the 6.x generation already and we don't intend to invest in
this space to close that gap.

As of 7.0, using this XML namespace will result in a WARN log message.
This commit also states our intent in the reference documentation.

Closes gh-34063
2024-12-17 11:55:08 +01:00
Sébastien Deleuze
f094c46172 Merge branch '6.2.x' 2024-12-17 11:40:53 +01:00
luozongle01
a942362221 Fix a typo
Closes gh-34101
2024-12-17 11:40:47 +01:00
rstoyanchev
7f4da52cc5 Remove Spring MVC path extension content negotiation
See gh-34036
2024-12-17 09:49:07 +00:00
rstoyanchev
e9946937e7 Remove Spring MVC suffixPattern and trailingSlash matching
See gh-34036
2024-12-17 09:49:04 +00:00
Brian Clozel
ca909483f1 Merge branch '6.2.x' 2024-12-17 10:20:19 +01:00
Brian Clozel
1a34b0dd87 Improve PathMatcher/PatternParser XML configuration
Prior to this commit, the MVC namespace for the XML Spring configuration
model would use the `PathMatcher` bean instance when provided like this:

```
<bean id="pathMatcher" class="org.springframework.util.AntPathMatcher"/>
<mvc:annotation-driven>
  <mvc:path-matching path-matcher="pathMatcher"/>
</mvc:annotation-driven>
<mvc:resources mapping="/resources/**" location="classpath:/static/"/>
```

With this configuration, the handler mapping for annotated controller
would use the given `AntPathMatcher` instance but the handler mapping
for resources would still use the default, which is `PathPatternParser`
since 6.0.

This commit ensures that when a custom `path-matcher` is defined, it's
consistently used for all MVC handler mappings as an alias to the
well-known bean name. This allows to use `AntPathMatcher` consistently
while working on a migration path to `PathPatternParser`

This commit also adds a new XML attribute to the path matching
configuration that makes it possible to use a custom `PathPatternParser`
instance:

```
<bean id="patternParser" class="org.springframework.web.util.pattern.PathPatternParser"/>
<mvc:annotation-driven>
  <mvc:path-matching pattern-parser="patternParser"/>
</mvc:annotation-driven>
```

Closes gh-34064
2024-12-17 10:14:18 +01:00
Sam Brannen
c75887c20d Merge branch '6.2.x' 2024-12-16 15:01:21 +01:00
Sam Brannen
b0fcde9aa3 Upgrade to JUnit 5.11.4
Closes gh-34095
2024-12-16 14:42:30 +01:00
Sam Brannen
dd094b5a17 Complete removal of local variable support in SpEL
See gh-33809
2024-12-15 15:55:38 +01:00
Sam Brannen
af83a152dc Polishing 2024-12-15 15:55:03 +01:00
Sam Brannen
aa7793a593 Removed unused code from ContentDisposition
See gh-33809
2024-12-15 15:54:23 +01:00
Sam Brannen
bf80485cc3 Clean up after deprecation of AsyncResult
See gh-33809
2024-12-15 15:53:33 +01:00
Sam Brannen
8a8df90a46 Restore TomcatHeadersAdapter.clear() behavior
This commit restores the original behavior of the clear() method in
TomcatHeadersAdapter by delegating to
org.apache.tomcat.util.http.MimeHeaders.recycle(), which aligns with
the memory efficiency goals documented in the class-level Javadoc for
MimeHeaders.

See gh-33916
Closes gh-34092
2024-12-15 15:34:49 +01:00
Johnny Lim
c8009dc67d Fix TomcatHeadersAdapter.clear()
This commit fixes a regression introduced in TomcatHeadersAdapter in
conjunction with gh-33916.

Closes gh-34092
2024-12-15 15:24:37 +01:00
Juergen Hoeller
5cbb5d4d70 Upgrade to Hibernate ORM 7.0.0.Beta3 and Validator 9.0.0.CR1
Using relocated Maven coordinates.

See gh-33750
2024-12-15 14:37:54 +01:00
Sam Brannen
30d249c3a7 Merge branch '6.2.x' 2024-12-14 17:14:47 +01:00
Sam Brannen
a89db89fc0 Polishing 2024-12-14 17:10:41 +01:00
Sam Brannen
34f74026f7 Merge branch '6.2.x' 2024-12-14 16:41:25 +01:00
Sam Brannen
3d0fffa8e4 Polish contribution
See gh-33945
2024-12-14 16:40:49 +01:00