Commit Graph

21652 Commits

Author SHA1 Message Date
Juergen Hoeller
2a34c0ea70 Return early from composed Converter if initial conversion step returned null
See gh-23379
2020-10-12 18:07:17 +02:00
Sam Brannen
fec89af239 Upgrade to JUnit 4.13.1
See gh-22894
2020-10-12 17:51:24 +02:00
Sam Brannen
6641dbc852 Discover test config on enclosing classes for nested test classes
Prior to this commit (and since Spring Framework 5.0), Spring's
integration with JUnit Jupiter supported detection of test
configuration (e.g., @ContextConfiguration, etc.) on @Nested classes.
However, if a @Nested class did not declare its own test configuration,
Spring would not find the configuration from the enclosing class. This
is in contrast to Spring's support for automatic inheritance of test
configuration from superclasses. The only workaround was to
copy-n-paste the entire annotation configuration from enclosing classes
to nested tests classes, which is cumbersome and error prone.

This commit introduces a new @NestedTestConfiguration annotation that
allows one to choose the EnclosingConfiguration mode that Spring should
use when searching for test configuration on a @Nested test class.
Currently, the options are INHERIT or OVERRIDE, where the current
default is OVERRIDE. Note, however, that the default mode will be
changed to INHERIT in a subsequent commit. In addition, support will be
added to configure the global default mode via the SpringProperties
mechanism in order to allow development teams to revert to the behavior
prior to Spring Framework 5.3.

As of this commit, inheritance of the following annotations is honored
when the EnclosingConfiguration mode is INHERIT.

- @ContextConfiguration / @ContextHierarchy
- @ActiveProfiles
- @TestPropertySource / @TestPropertySources
- @WebAppConfiguration
- @TestConstructor
- @BootstrapWith
- @TestExecutionListeners
- @DirtiesContext
- @Transactional
- @Rollback / @Commit

This commit does NOT include support for inheriting the following
annotations on enclosing classes.

- @Sql / @SqlConfig / @SqlGroup

In order to implement this feature, the search algorithms in
MetaAnnotationUtils (and various other spring-test internals) have been
enhanced to detect when annotations should be looked up on enclosing
classes. Other parts of the ecosystem may find the new
searchEnclosingClass() method in MetaAnnotationUtils useful to provide
similar support.

As a side effect of the changes in this commit, validation of user
configuration in repeated @TestPropertySource declarations has been
removed, but this may be reintroduced at a later date.

Closes gh-19930
2020-10-12 17:34:47 +02:00
Rossen Stoyanchev
b9f7b0d955 Upgrade to Reactor 2020.0-RC2
See gh-25884
2020-10-12 14:26:51 +01:00
Rossen Stoyanchev
809851c0fe Replace MonoProcessor with AtomicRef for RSocket RESPONSE_HEADER
See gh-25884
2020-10-12 11:55:20 +01:00
Rossen Stoyanchev
5b1b20c8c0 Polishing and minor refactoring
See gh-25884
2020-10-12 11:55:20 +01:00
xuxiang
66138f0dce Fix a few typos in the web reference docs
Closes gh-25893

Co-authored-by: zhiyi.xx <zhiyi.xx@antfin.com>
2020-10-10 16:35:56 +02:00
Rossen Stoyanchev
e73e489fd8 Remove use of MonoProcessor.fromSinks
See gh-25884
2020-10-09 20:46:21 +01:00
Sébastien Deleuze
cdd48ddd7f Improve Coroutines support consistency 2020-10-09 12:51:08 +02:00
Sébastien Deleuze
c4de445822 Upgrade to kotlinx.serialization 1.0.0 2020-10-09 12:41:52 +02:00
Sébastien Deleuze
94a42a3086 Support suspending handler methods in Spring MVC
This commit adds support for Kotlin Coroutines suspending functions to
Spring MVC, by converting those to a Mono that can then be handled by
the asynchronous request processing feature.

It also optimizes Coroutines detection with the introduction of an
optimized KotlinDetector.isSuspendingFunction() method that does not
require kotlin-reflect.

Closes gh-23611
2020-10-09 12:25:32 +02:00
Juergen Hoeller
fad7243733 Upgrade to RxJava 3.0.7, Undertow 2.2.2, WebJars Locator 0.46 2020-10-09 09:21:46 +02:00
Rossen Stoyanchev
d49a7a105d Fix failing tests from Reactor snapshot changes
See gh-25884
2020-10-08 18:38:05 +01:00
Rossen Stoyanchev
24bd0148d5 Switch to Reactor snapshots
See gh-25884
2020-10-08 14:59:36 +01:00
Rossen Stoyanchev
fee8abfa5f Drop "[]" from parameter names in data binding
Closes gh-25836
2020-10-07 16:44:58 +01:00
Juergen Hoeller
d05803aa04 Upgrade to Jackson 2.11.3, Apache HttpClient 5.0.3, HtmlUnit 2.44 2020-10-07 15:51:30 +02:00
Juergen Hoeller
d55c5b30d7 Merge branch '5.2.x' 2020-10-07 15:34:57 +02:00
Juergen Hoeller
ec9de943ee Construct StringBuilder in StreamUtils with appropriate initial size
Closes gh-25789
2020-10-07 15:11:53 +02:00
Rossen Stoyanchev
1c1bc41e24 Merge branch '5.2.x' into master 2020-10-07 12:45:51 +01:00
Rossen Stoyanchev
eb11c6fa23 Reinstate removal of jsessionid from lookup path
Closes gh-25864
2020-10-07 11:31:52 +01:00
Sébastien Deleuze
7d7ed88739 Provide WebClient#exchange() alternative for Coroutines
This commit adds awaitExchange { } and
exchangeToFlow { } extensions as Coroutines variants for
exchangeToMono() and exchangeToFlux().

Closes gh-25751
2020-10-07 11:09:12 +02:00
Sébastien Deleuze
e899397438 Add missing ClientResponse Coroutines extensions
This commit adds awaitBodilessEntity() and
createExceptionAndAwait() missing ClientResponse
Coroutines extensions.

Closes gh-25866
2020-10-07 11:06:43 +02:00
Arjen Poutsma
b2d8180f82 Add params and remoteAddress to request builder
This commit adds methods for adding/changing parameters and remote
address in the WebMvc.fn request builder.

Closes gh-25776
2020-10-07 10:30:02 +02:00
Sébastien Deleuze
9990bd2ea8 Fix checkstyle errors
See gh-25771
2020-10-06 23:13:38 +02:00
Sébastien Deleuze
92b2c45281 Add kotlinx.serialization JSON support to Spring WebFlux
Flow decoding is not supported yet since it depends on
kotlin/kotlinx.serialization#1073, but it will be
enabled when this issue will be fixed.

Closes gh-25771
2020-10-06 23:02:33 +02:00
Rossen Stoyanchev
1cd8871d7f FormHttpMessageConverter preserves MediaType parameters
Closes gh-25839
2020-10-06 18:28:39 +01:00
Rossen Stoyanchev
1c5b95db0b Revert workaround in Jetty connector
The workaround was removed in the 5.3 milestone phase and in master
only because the referenced Jetty issue is marked fixed. However,
what we need to replace it with should be a little more involved
and also it's not entirely clear if the fixes in Jetty aligns with
our release and retain semantics so that needs to be investigated
more thoroughly.
2020-10-06 18:18:26 +01:00
Rossen Stoyanchev
30c7940483 Fix recent regression in WebTestClient
Closes gh-25854
2020-10-06 17:04:48 +01:00
Juergen Hoeller
e78aa6b8f8 Upgrade to Groovy 3.0.6 2020-10-06 16:55:58 +02:00
Juergen Hoeller
f5d9babfd2 Avoid reflection when creating instances of well-known View classes
Closes gh-25847
2020-10-06 16:55:42 +02:00
Brian Clozel
a0af552d0f Add option for ignoring last-modified for static resources
Prior to this commit, the resource handler serving static resources for
Spring MVC and Spring WebFlux would always look at the
`Resource#lastModified` information, derive the `"Last-Modified"` HTTP
response header and support HTTP conditional requests with that
information.

In some cases, builds or packaging tools choose to set this last
modification date to a static date in the past. This allows tools to
have reproducible builds or to leverage caching given the static
resources content didn't change.

This can lead to problems where this static date (e.g. "1980-01-01") is
used literally in HTTP responses and will make the HTTP caching
mechanism counter-productive: the content of the resources changed, but
the application insists on saying it didn't change since the 80s...

This commit adds a new configuration option to disable this support -
there is no way to automatically discard those dates: there is no
standard for that and many don't use he "EPOCH 0 date" as it can lead to
compatibility issues with different OSes.

Closes gh-25845
2020-10-06 16:30:35 +02:00
Philippe Marschall
cf61545f41 Add Dependencies Manifest Entry to spring-core
Add a Dependencies manifest entry with the value jdk.unsupported to
spring-core.
2020-10-06 15:45:49 +02:00
Сергей Цыпанов
8a04910bdd Drop explicit zeroing at instantiation of Atomic* objects 2020-10-06 15:45:12 +02:00
Juergen Hoeller
b7e1553c9d Merge branch '5.2.x'
# Conflicts:
#	build.gradle
#	spring-orm/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBuilder.java
2020-10-06 15:37:54 +02:00
Arjen Poutsma
392895e256 Revert errorhandler order in RouterFunctionBuilder
Prior to this commit, error handlers in the WebMvc.fn and WebFlux.fn
router function builders had to be registered in an unintuitive, reverse
order, due to the filter chain composition model used.
This commit reverses the error handler order, so that more specific
error handlers can come before generic ones.

Closes gh-25541
2020-10-06 15:32:22 +02:00
Juergen Hoeller
ca7fb23432 Upgrade to Hibernate ORM 5.4.22, Hibernate Validator 6.1.6, Undertow 2.0.32, Checkstyle 8.36.2 2020-10-06 15:31:46 +02:00
Juergen Hoeller
f83bb7183e Polishing 2020-10-06 15:31:34 +02:00
Juergen Hoeller
1745a3f25d Consistent @Nullable declarations on overridden converter methods 2020-10-06 15:31:26 +02:00
Juergen Hoeller
e417318915 Revise native Hibernate 5 bootstrapping with JTA transaction manager
Closes gh-25858
2020-10-06 15:31:19 +02:00
Arjen Poutsma
200b33b26a Add no path HTTP method variants for route builder
This commit adds two overloaded methods for each HTTP method in the
WebFlux.fn and WebMvc.fn route builders: one method taking just a
handler function, the other a request predicate and handler function.

After this commit, it is no longer required to provide a String path,
which is particularly useful when nesting routes, and the path would be
"".

Closes gh-25752
2020-10-06 11:00:17 +02:00
Rossen Stoyanchev
d3087537d5 Merge branch '5.2.x' into master 2020-10-02 14:39:27 +01:00
Arjen Poutsma
444c8185b6 Add document on async support in WebMvc.fn
This commit adds reference documentation about the support for
asynchronous types in WebMvc.fn.
2020-10-02 15:04:25 +02:00
Rossen Stoyanchev
2533ba5253 Use Mono.fromDirect for Jetty ReactiveRespnose
Closes gh-25849
2020-10-02 13:43:42 +01:00
Rossen Stoyanchev
e44b08f1fc Minor refactoring in JettyClientHttpConnector
See gh-25849
2020-10-02 13:32:00 +01:00
Arjen Poutsma
3303a68436 Use registry to convert to CompletableFuture
Use the ReactiveAdapterRegistry to convert to CompletableFuture,
and remove the ToFutureSubscriber.
2020-10-02 11:39:31 +02:00
Arjen Poutsma
4e76a4780c Add ServerResponse.async() in WebMvc.fn
This commit introduces a new async(Object) method in the WebMvc.fn,
taking a asynchronous response as argument in the form of a
CompletableFuture or Publisher. This allows for asynchronous setting
of headers and status (and not just body, which was already possible).

Closes gh-25828
2020-10-02 10:36:16 +02:00
Sam Brannen
c083b95ce1 Polishing 2020-10-01 15:42:06 +02:00
Sam Brannen
92cc006b2c Delete unused code 2020-10-01 15:14:55 +02:00
Rossen Stoyanchev
dfb7ca733a Merge branch '5.2.x' into master 2020-09-30 22:10:42 +01:00
Rossen Stoyanchev
86f2ebec1b Fix recursion issue caused by previous commit
See gh-25821
2020-09-30 22:03:46 +01:00