Commit Graph

30199 Commits

Author SHA1 Message Date
Stéphane Nicoll
975e2f4218 Revert "Avoid deprecation warnings for WebJarsResourceResolver"
This reverts commit 61db499ae2.
2024-05-23 16:21:42 +02:00
Stéphane Nicoll
0ac7e41beb Provide an implementation of JsonComparator
See gh-32791
2024-05-23 16:17:02 +02:00
Sébastien Deleuze
f62275d674 Merge branch '6.1.x' 2024-05-23 16:05:54 +02:00
Attacktive
73eb6f0660 Complete a Kotlin code snippet in the refdoc
Closes gh-32877
2024-05-23 16:03:34 +02:00
Brian Clozel
51f6e78e25 Fall back on */* during content negotiation for errors
Prior to this commit, gh-31936 enabled content negotiation for
`@ExceptionHandler` annotated methods in Spring MVC and WebFlux.
In the case of WebFlux, HTTP clients sending invalid media types in the
"Accept" request header would fail with a `NotAcceptableStatusException`
This exception would be handled with an HTTP 406 response status,
instead of processing the original exception.

This commit ensures that invalid media types are ignored during the
exception handling phase and that we fall back to "*/*".

Fixes gh-32878
2024-05-23 13:57:02 +02:00
Stéphane Nicoll
94348d9d41 Revert "Merge pull request #32876 from quaff"
This reverts commit 3b2a4da023, reversing
changes made to 181b68088a.

See gh-32876
2024-05-23 13:13:02 +02:00
Phillip Webb
d8dcd3af0b Introduce JSON comparison abstraction for tests
This commit introduces a JsonComparator abstraction, with an
implementation using JSONAssert. Previously, JSONAssert was the only
choice.

Test APIs have been adapted to allow the new abstraction while relying
on JSONAssert still for high-level methods.

Closes gh-32791

Co-authored-by: Stéphane Nicoll <stephane.nicoll@broadcom.com>
2024-05-23 12:32:39 +02:00
Arjen Poutsma
80faa94afc Support Map in FormHttpMessageConverter
This commit changes the FormHttpMessageConverter from a
HttpMessageConverter<MultiValueMap<String, ?>> to a
HttpMessageConverter<Map<String, ?>>, so that normal, single-value maps
can also be used as form representation, both for reading and writing.

Closes gh-32826
2024-05-23 10:33:49 +02:00
Arjen Poutsma
67d2b2566e Revert "WIP"
This reverts commit c09b0f57631905a7b9cca32be5516853e4263ac0.
2024-05-23 10:33:49 +02:00
Arjen Poutsma
14861024d5 WIP 2024-05-23 10:33:49 +02:00
Stéphane Nicoll
fa275f908e Polish 2024-05-23 08:49:03 +02:00
Stéphane Nicoll
3b2a4da023 Merge pull request #32876 from quaff
* pr/32876:
  Polish "Extend nested placeholders resolution to any CharSequence"
  Extend nested placeholders resolution to any CharSequence

Closes gh-32876
2024-05-23 08:41:59 +02:00
Stéphane Nicoll
79b5ee75d3 Polish "Extend nested placeholders resolution to any CharSequence"
See gh-32876
2024-05-23 08:36:34 +02:00
Yanming Zhou
5a7bfa9dec Extend nested placeholders resolution to any CharSequence
See gh-32876
2024-05-23 08:36:15 +02:00
Stéphane Nicoll
181b68088a Merge branch '6.1.x' 2024-05-23 08:14:59 +02:00
Stéphane Nicoll
31f298b929 Merge pull request #32874 from Seungpang
* pr/32874:
  Polish
  Document using ThreadLocal#remove instead of ThreadLocal#set(null)

Closes gh-32874
2024-05-23 08:14:00 +02:00
Stéphane Nicoll
c01aab5850 Polish
See gh-32874
2024-05-23 08:12:30 +02:00
Seungrae
61ef5a8930 Document using ThreadLocal#remove instead of ThreadLocal#set(null)
See gh-32874
2024-05-23 08:10:54 +02:00
Spring Builds
3b53ee7038 Next development version (v6.1.9-SNAPSHOT) 2024-05-22 16:45:49 +00:00
rstoyanchev
39320b904e Merge branch '6.1.x' 2024-05-22 17:16:18 +01:00
rstoyanchev
89dd247b97 Improve docs on controller method validation
Closes gh-32807
2024-05-22 17:15:54 +01:00
rstoyanchev
1ddc84862e Improve docs on controller method validation
Closes gh-32807
2024-05-22 17:12:09 +01:00
Sam Brannen
48e7908eff Polishing 2024-05-22 15:57:41 +02:00
Sam Brannen
61db499ae2 Avoid deprecation warnings for WebJarsResourceResolver 2024-05-22 15:57:41 +02:00
Juergen Hoeller
2170db6996 Skip expression resolution in getShadowMatch (aligned with 6.1.x)
See gh-32793
See gh-32838
2024-05-22 15:39:36 +02:00
Sam Brannen
bc291949c2 Polishing 2024-05-22 15:09:54 +02:00
Stéphane Nicoll
1bc71824ea Merge branch '6.1.x' 2024-05-22 14:46:33 +02:00
Stéphane Nicoll
39dd1e4049 Remove outdated Javadoc links
Closes gh-32872
2024-05-22 14:40:25 +02:00
Sam Brannen
b47cdaa259 Lazily register DynamicValuesPropertySource in the TestContext framework
Prior to this commit, as a result of commit 6cdb34410b, the
DynamicValuesPropertySource was eagerly registered in the Environment
even if the DynamicPropertyRegistry was never used to register dynamic
properties.

This commit ensures that the DynamicValuesPropertySource is only
registered if we know that the DynamicPropertyRegistry is actually used
-- either by a @⁠DynamicPropertySource method in a test class or via a
bean in the ApplicationContext that invokes add() on the
DynamicPropertyRegistry bean.

See gh-32271
Closes gh-32871
2024-05-22 14:25:19 +02:00
Sébastien Deleuze
c9a6b7f01e Merge branch '6.1.x' 2024-05-22 10:32:05 +02:00
Rob Winch
34f4ad3b71 Modernize Antora Build
- Use same playbook as docs-build
- Use Env Variables to cause partial build (same as docs-build)
- Use package.json so that dependencies can be updated with dependabot
2024-05-22 10:20:20 +02:00
Juergen Hoeller
e4f35ebcc5 Merge branch '6.1.x' 2024-05-22 10:01:30 +02:00
Juergen Hoeller
ea596aa211 Select most specific advice method in case of override
Closes gh-32865
2024-05-22 10:00:31 +02:00
Brian Clozel
1bd6b30ddd Allow ServerHttpObservationFilter to be extended
This commit allows to extend  the `ServerHttpObservationFilter` when the
observation scope is opened. This typically allows to add the current
traceId as a response header.

Closes gh-30632
2024-05-21 20:01:17 +02:00
Juergen Hoeller
559fec052f Merge branch '6.1.x' 2024-05-21 19:22:55 +02:00
Juergen Hoeller
58da30cd30 Upgrade to Jetty Reactive HttpClient 4.0.4 2024-05-21 19:22:20 +02:00
Juergen Hoeller
cd33b4e35a Polishing 2024-05-21 18:25:57 +02:00
Juergen Hoeller
0e5e81e7ef Merge branch '6.1.x' 2024-05-21 17:39:59 +02:00
Juergen Hoeller
20dea0dae2 Polishing 2024-05-21 17:39:11 +02:00
Juergen Hoeller
fee17e11ba Default fallback parsing for UTC without milliseconds
Closes gh-32856
2024-05-21 17:39:06 +02:00
rstoyanchev
8c9b6e2205 Use default phase 0 for WebSocket messaging
Closes gh-27519
2024-05-21 15:49:38 +01:00
Simon Baslé
d5c7a5e2db Bean overriding by type uses isAutowireCandidate for matching
This commit uses the bean factory `isAutowiredCandidate` method directly
in `BeanOverrideBeanFactoryPostProcessor` to select a single match among
multiple candidates when matching by type.

The expected consequence, in most cases, is that this will delegate to
a `@Qualifier`-aware `QualifierAnnotationAutowireCandidateResolver`.
In that sense, bean overriding by-type matching is now potentially
taking Qualifier annotations or meta-annotations into account.

It also changes the way existing bean definitions are checked in case
a bean name has been specified: factory beans are now taken into account
when checking the type of an existing definition matches the expected
bean override type.

Closes gh-32822
2024-05-21 14:06:52 +02:00
Simon Baslé
b17d1c5124 Polishing BeanOverrideBeanFactoryPostProcessor to also copy isFallback 2024-05-21 14:06:52 +02:00
Juergen Hoeller
6f6e25bd5b Merge branch '6.1.x' 2024-05-21 11:17:16 +02:00
Juergen Hoeller
65e1337d35 Polishing 2024-05-21 11:16:25 +02:00
Juergen Hoeller
a4c2f291d9 Avoid creation of SAXParserFactory for every read operation
Includes JAXBContext locking revision (avoiding synchronization) and consistent treatment of DocumentBuilderFactory (in terms of caching as well as locking).

Closes gh-32851
2024-05-21 11:16:19 +02:00
Stéphane Nicoll
ddf5521bc9 Merge branch '6.1.x' 2024-05-21 08:56:41 +02:00
Stéphane Nicoll
f26483d272 Detect deprecated element in generic types
This commit updates Spring AOT to suppress a deprecation warning for
a generic type that has a deprecated element. Previously we only were
checking for the raw class.

Closes gh-32850
2024-05-21 08:53:18 +02:00
Brian Clozel
4d4b343815 Support Content Negotiation with @ExceptionHandler
Prior to this commit, `@ExceptionHandler` annotated controller methods
could be mapped using the exception type declaration as an annotation
attribute, or as a method parameter.
While such methods support a wide variety of method arguments and return
types, it was not possible to declare the same exception type on
different methods (in the same controller/controller advice).

This commit adds a new `produces` attribute on `@ExceptionHandler`; with
that, applications can vary the HTTP response depending on the exception
type and the requested content-type by the client:

```
@ExceptionHandler(produces = "application/json")
public ResponseEntity<ErrorMessage> handleJson(IllegalArgumentException exc) {
	return ResponseEntity.badRequest().body(new ErrorMessage(exc.getMessage(), 42));
}

@ExceptionHandler(produces = "text/html")
public String handle(IllegalArgumentException exc, Model model) {
	model.addAttribute("error", new ErrorMessage(exc.getMessage(), 42));
	return "errorView";
}
```

This commit implements support in both Spring MVC and Spring WebFlux.

Closes gh-31936
2024-05-20 17:22:30 +02:00
Stéphane Nicoll
991be14847 Merge branch '6.1.x' 2024-05-20 13:58:44 +02:00