Commit Graph

32657 Commits

Author SHA1 Message Date
Sébastien Deleuze
185537d469 Refine jsr305 dependency management
See gh-28797
2024-12-26 14:13:17 +01:00
Sébastien Deleuze
92f1f55957 Refine null-safety in the spring-aop module
Closes gh-34154
2024-12-26 13:53:25 +01:00
Sébastien Deleuze
b4a2cdf028 Merge branch '6.2.x' 2024-12-26 13:18:16 +01:00
Sébastien Deleuze
1ed74efa6b Polishing
Closes gh-34148
2024-12-26 13:16:09 +01:00
Brenden Ehlers
eabd574038 Fix XML code snippet
See gh-34148
2024-12-26 13:15:51 +01:00
Sébastien Deleuze
8b741f3a46 Refine null-safety in the spring-beans module
Closes gh-34152
2024-12-26 11:24:05 +01:00
Sébastien Deleuze
1c37e7092e Use @SuppressWarnings("NullAway.Init")`
This commit uses `@SuppressWarnings("NullAway.Init")` when
relevant.

See gh-34147
See gh-34151
2024-12-26 10:47:10 +01:00
Simon Baslé
f24f9a4ba4 Polishing
Javadoc links to `HttpHeaders#remove` now use the new String-based
signature.

See gh-33913
2024-12-26 10:30:46 +01:00
Stéphane Nicoll
cf49a33ea4 Merge branch '6.2.x' 2024-12-25 09:30:08 +01:00
Stéphane Nicoll
ea386c2398 Merge pull request #34149 from brendenehlers
* pr/34149:
  Fix typo in link

Closes gh-34149
2024-12-25 09:29:52 +01:00
Brenden Ehlers
6c6e8ad831 Fix typo in link
See gh-34149
2024-12-25 09:29:29 +01:00
Sébastien Deleuze
f368147f9d Refine null-safety in the spring-context module
Closes gh-34151
2024-12-24 18:27:13 +01:00
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