Commit Graph

31788 Commits

Author SHA1 Message Date
Sam Brannen
ae3bec5d57 Allow test classes to provide runtime hints via declarative mechanisms
Prior to this commit, it was possible to register hints for individual
test classes programmatically via the
org.springframework.test.context.aot.TestRuntimeHintsRegistrar SPI;
however, that requires that a custom TestRuntimeHintsRegistrar be
registered via "META-INF/spring/aot.factories". In addition,
implementing a TestRuntimeHintsRegistrar is more cumbersome than using
the core mechanisms such as @Reflective, @ImportRuntimeHints, and
@RegisterReflectionForBinding.

This commit address this by introducing support for @Reflective and
@ImportRuntimeHints on test classes. @RegisterReflectionForBinding
support is available automatically since it is an extension of the
@Reflective mechanism.

Closes gh-29455
2022-11-12 14:41:09 +01:00
Sam Brannen
1b61217705 Polishing 2022-11-12 14:40:55 +01:00
Juergen Hoeller
ffd45c0e7b Move reflection hints for ObjectToObjectConverter conventions to aot.hint.support
Avoids an accidental package cycle between aot and core (only aot->core allowed).

See gh-29429
2022-11-12 11:23:40 +01:00
Sam Brannen
049eb98e00 Merge branch '5.3.x' 2022-11-11 17:12:28 +01:00
67
3ff308403a Fix two typos in integration.adoc and webflux.adoc
- Change "you ca" to "you can" in webflux.adoc

- English names can be used in "month" field instead of "day-of-month"
  field in cron expressions in integration.adoc

Closes gh-29469
2022-11-11 17:11:16 +01:00
Sam Brannen
27f3feea1a Ensure SpEL ternary and Elvis expressions are enclosed in parentheses in toStringAST()
Prior to this commit, ternary and Elvis expressions enclosed in
parentheses (to account for operator precedence) were properly parsed
and evaluated; however, the corresponding toStringAST() implementations
did not enclose the results in parentheses. Consequently, the string
representation of the ASTs did not reflect the original semantics of
such expressions.

For example, given "(4 % 2 == 0 ? 1 : 0) * 10" as the expression to
parse and evaluate, the result of toStringAST() was previously
"(((4 % 2) == 0) ? 1 : 0 * 10)" instead of
"((((4 % 2) == 0) ? 1 : 0) * 10)", implying that 0 should be multiplied
by 10 instead of multiplying the result of the ternary expression by 10.

This commit addresses this by ensuring that SpEL ternary and Elvis
expressions are enclosed in parentheses in toStringAST().

Closes gh-29463
2022-11-11 17:11:07 +01:00
Sam Brannen
b42b785cd1 Polish ParsingTests 2022-11-11 17:10:57 +01:00
rstoyanchev
e0b405869f Merge branch '5.3.x' 2022-11-11 15:16:26 +00:00
rstoyanchev
479a53b132 Update docs on DispatcherHandler exception handling
See gh-22991
2022-11-11 13:51:21 +00:00
rstoyanchev
0348a7bf2e Improve API for RFC 7807 in functional endpoints
Closes gh-29462
2022-11-11 13:34:35 +00:00
rstoyanchev
f9d8367379 Exclude URL query from checkpoint in DefaultWebClient
Closes gh-29148
2022-11-11 13:29:36 +00:00
rstoyanchev
09b19d7aa6 Update RestTemplate Javadoc
Closes gh-29311
2022-11-11 12:16:02 +00:00
rstoyanchev
8ade083a05 Filter out null WebSocketSession attributes
Closes gh-29315
2022-11-11 11:20:18 +00:00
rstoyanchev
db9e89fba9 Update docs on web controller method return values
Closes gh-29349
2022-11-11 11:03:24 +00:00
Juergen Hoeller
9d1dfc733d Upgrade to R2DBC H2 1.0.0
See gh-28787
2022-11-11 09:39:05 +01:00
Juergen Hoeller
ddbbe67361 Upgrade to Reactor 2022.0.0
Includes Netty 4.1.85, Jetty Reactive HttpClient 3.0.7, SmallRye Mutiny 1.8, SLF4J 2.0.3, OpenPDF 1.3.30, Mockito 4.8.1, HtmlUnit 2.66

Closes gh-29465
2022-11-10 18:55:00 +01:00
Juergen Hoeller
0e4ab2c63a Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java
#	spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java
#	spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletRequest.java
#	spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletResponse.java
2022-11-10 18:29:05 +01:00
Juergen Hoeller
d7d44c6c51 Polishing 2022-11-10 18:26:49 +01:00
Juergen Hoeller
330d2a5982 Upgrade to Reactor 2020.0.24
Includes Netty 4.1.85, Tomcat 9.0.68, Jetty 9.4.49, Jetty Reactive HttpClient 1.1.13, Undertow 2.2.21, SmallRye Mutiny 1.8, Log4J 2.19, OpenPDF 1.3.30, Mockito 4.8.1, HtmlUnit 2.66, Checkstyle 10.4

Closes gh-29464
2022-11-10 18:25:55 +01:00
Juergen Hoeller
86fbb8678a Use unquoted value in assertion message in MediaType.checkParameters()
Closes gh-29461
2022-11-10 18:24:57 +01:00
Sam Brannen
1443669091 Polishing 2022-11-10 17:25:20 +01:00
Johnny Lim
4c2072d20c Use unquoted value in assertion message in MediaType.checkParameters() 2022-11-10 15:48:39 +01:00
rstoyanchev
fb22044c10 Polishing
See gh-22991
2022-11-09 11:34:32 +00:00
Stephane Nicoll
da4b539f20 Stop generating generic type as Object for unresolved generics
Closes gh-29454
2022-11-09 12:00:34 +01:00
Juergen Hoeller
70bb785ed6 Turn nested generic FactoryBean type into resolved Class for fallback match
See gh-29385
2022-11-09 11:24:50 +01:00
Sam Brannen
69736af5fc Revise ContextLoadException constructor to accept a Throwable 2022-11-08 20:35:17 +01:00
Juergen Hoeller
0e9eab55ce Unwrap nested generic type within FactoryBean target type if necessary
Closes gh-29385
2022-11-08 20:22:12 +01:00
Sam Brannen
f26a7dee97 Fix broken tests, update copyright dates, and polish
See gh-29414
2022-11-08 20:07:53 +01:00
Kulwant Singh
b2c8546013 Rely on automatic boxing/unboxing in tests
Closes gh-29414
2022-11-08 19:38:03 +01:00
Sam Brannen
7d68d0625c Polishing 2022-11-08 19:32:46 +01:00
Kulwant Singh
debe78b7f9 Minor improvements in spring-test
- Remove final modifier from private method
- Use StandardCharsets
- Remove unnecessary toString calls
- Remove unnecessary static modifiers
- Refactor to use enhanced switch
- Replace concatenated strings with text blocks
- Rely on auto-boxing where appropriate
- Remove unnecessary code
- Fix imports in Kotlin test classes

Closes gh-29413
2022-11-08 19:32:46 +01:00
rstoyanchev
307247b6a3 Use DispatchExceptionHandler in HandlerResult
Commit #2878ad added the DispatchExceptionHandler contract for
mapping an error before a handler is selected to a HandlerResult.
The same is also convenient for use in HandlerResult itself which
currently uses a java.util.Function essentially for the same.

See gh-22991
2022-11-08 18:31:35 +00:00
Sam Brannen
a9a78686ed Merge branch '5.3.x'
# Conflicts:
#	spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java
2022-11-08 18:13:26 +01:00
Christoph Dreis
55b258f2de Avoid unnecessary allocations in StompDecoder#unescape
Closes gh-29443
2022-11-08 18:10:54 +01:00
Sam Brannen
e058a6061a Move DataFieldMaxValueIncrementerTests to the appropriate package 2022-11-08 18:02:19 +01:00
Sam Brannen
8595493599 Polish contribution 2022-11-08 18:00:50 +01:00
Mahmoud Ben Hassine
f9ed0721a8 Introduce DataFieldMaxValueIncrementer for SQL Server sequences
This commit introduces SqlServerSequenceMaxValueIncrementer to support
SQL Server sequences, complementing the existing
SqlServerMaxValueIncrementer for table-based support.

Closes gh-29447
2022-11-08 17:54:16 +01:00
Sébastien Deleuze
ce9e2e4d89 Register reflection hints for date ObjectToObjectConverter conventions
Closes gh-29429
2022-11-08 17:39:37 +01:00
Sam Brannen
af170f693a Deprecate obsolete Assert APIs for removal in 6.1
See gh-29449
2022-11-08 16:55:06 +01:00
Sam Brannen
727aa517d8 Merge branch '5.3.x' 2022-11-08 16:34:40 +01:00
Sam Brannen
f4b3333fa8 Avoid reflection for annotation attribute method invocations
As a follow up to 332b25b680, this commit consistently avoids the use of
reflection for annotation attribute method invocations.

See gh-29301
Closes gh-29448
2022-11-08 16:23:33 +01:00
Sébastien Deleuze
60c9f2f72f Add support for Jackson annotations in BindingReflectionHintsRegistrar
This commits registers reflection hints on field and methods
where Jackson annotations are detected.

Closes gh-29426
2022-11-08 16:19:27 +01:00
rstoyanchev
2878ade980 WebFlux support for handling of early exceptions
This change enables a WebFlux HandlerAdapter to handle not only the
success scenario when a handler is selected, but also any potential
error signal that may occur instead. This makes it possible to
extend ControllerAdvice support to exceptions from handler mapping
such as a 404, 406, 415, and/or even earlier exceptions from the
WebFilter chain.

Closes gh-22991
2022-11-08 15:13:18 +00:00
Sam Brannen
9d73f81e9c Avoid String allocations with Assert.notNull() 2022-11-08 14:23:22 +01:00
Sam Brannen
9e4cddf5db Fix precondition assertions 2022-11-08 14:21:58 +01:00
Sam Brannen
d0b162a76c Polishing 2022-11-08 14:16:00 +01:00
Sam Brannen
95f3337bb5 Revise contribution
This commit reverts changes to AbstractCacheManager since iterating
over the caches in a for-loop and a stream is duplicated effort.

This commit reverts changes to DefaultRenderingResponseBuilder,
RouterFunctions, and OriginHandshakeInterceptor since order matters for
those use cases: they were originally based on the semantics of
LinkedHashSet or LinkedHashMap; whereas, Set.copyOf() and Map.copyOf()
do not provide any guarantees regarding ordering.

This commit also applies analogous changes to "sibling" implementations
across Servlet mocks as well as Web MVC and WebFlux.

See gh-29321
2022-11-08 14:14:29 +01:00
divcon
ba136dcf40 Replace use of Collections.unmodifiable*() methods where appropriate
Closes gh-29321
2022-11-08 13:51:31 +01:00
Juergen Hoeller
86d45578d9 Introduce findAllAnnotationsOnBean variant on ListableBeanFactory
Closes gh-29446
2022-11-08 13:29:33 +01:00
Sam Brannen
e1010a179f Merge branch '5.3.x'
# Conflicts:
#	spring-context/src/test/java/org/springframework/context/annotation/Gh29105Tests.java
2022-11-08 12:27:40 +01:00