Commit Graph

21782 Commits

Author SHA1 Message Date
Sébastien Deleuze 3f01af6f7c Add kotlinx.serialization JSON support to Spring Messaging
Closes gh-25883
2020-10-26 20:10:54 +01:00
Juergen Hoeller f329748657 Merge branch '5.2.x' 2020-10-26 18:32:16 +01:00
Juergen Hoeller d12996a6a8 Polishing 2020-10-26 18:18:33 +01:00
Sébastien Deleuze d04c5f8b2c Support multiple matchers in MockMvc Kotlin DSL
Previous incarnation of MockMvc Kotlin DSL tried to reuse directly
Java APIs like ModelResultMatchers or StatusResultMatchers, but
when using multiple matchers in DSL blocks like model { } or
status { }, only the last statement was taken in account which
was very confusing.

This refactoring provides dedicated Kotlin DSLs for matchers.

The main API breaking changes is that functions like isOk() need to be
invoked with the parenthesis, isOk is not supported anymore (on purpose).

Closes gh-24103
2020-10-26 18:13:55 +01:00
Juergen Hoeller 41247d49ba R2DBC javadoc and code style revision
See gh-25065
2020-10-26 17:47:20 +01:00
Juergen Hoeller 16c8676e5b Use ConcurrentLruCache (aligned with NamedParameterJdbcTemplate)
See gh-24197
2020-10-26 17:37:20 +01:00
Juergen Hoeller d7f1813cd7 R2DBC and Hibernate documentation revision
Closes gh-25860
Closes gh-25533
2020-10-26 17:33:00 +01:00
Sam Brannen ada255d584 Ignore duplicate config metadata for cache key in TestContext framework
Prior to this commit, if a developer accidentally copied and pasted the
same @ContextConfiguration or @TestPropertySource declaration from a
test class to one of its subclasses or nested test classes, the Spring
TestContext Framework (TCF) would merge the inherited configuration
with the local configuration, resulting in different sets of
configuration metadata which in turn resulted in a different
ApplicationContext instance being loaded for the test classes. This
behavior led to unnecessary creation of identical application contexts
in the context cache for the TCF stored under different keys.

This commit ignores duplicate configuration metadata when generating
the ApplicationContext cache key (i.e., MergedContextConfiguration) in
the TCF. This is performed for the following annotations.

- @ContextConfiguration
- @ActiveProfiles (support already existed prior to this commit)
- @TestPropertySource

Specifically, if @ContextConfiguration or @TestPropertySource is
declared on a test class and its subclass or nested test class with the
exact same attributes, only one instance of the annotation will be used
to generate the cache key for the resulting ApplicationContext. The
exception to this rule is an "empty" annotation declaration. An empty
@ContextConfiguration or @TestPropertySource declaration signals that
Spring (or a third-party SmartContextLoader) should detect default
configuration specific to the annotated class. Thus, multiple empty
@ContextConfiguration or @TestPropertySource declarations within a test
class hierarchy are not considered to be duplicate configuration and
are therefore not ignored.

Since @TestPropertySource is a @Repeatable annotation, the same
duplicate configuration detection logic is applied for multiple
@TestPropertySource declarations on a single test class or test
interface.

In addition, this commit reinstates validation of the rules for
repeated @TestPropertySource annotations that was removed when support
for @NestedTestConfiguration was introduced.

Closes gh-25800
2020-10-26 17:17:53 +01:00
Stephane Nicoll 7aef0c78a0 Merge branch '5.2.x' 2020-10-26 17:02:11 +01:00
Stephane Nicoll 188a5a086b Upgrade to Reactor Dysprosium-SR13
Closes gh-25946
2020-10-26 17:00:46 +01:00
Sam Brannen 705cf09ad7 Merge branch '5.2.x' 2020-10-26 15:05:35 +01:00
Sam Brannen 449377908f Fix JUnit 4 to AssertJ migration bugs
The migration from JUnit 4 assertions to AssertJ assertions resulted in
several unnecessary casts from int to long that actually cause
assertions to pass when they should otherwise fail.

This commit fixes all such bugs for the pattern `.isNotEqualTo((long)`.
2020-10-26 14:53:09 +01:00
Sam Brannen b1fef925af Cache DefaultActiveProfilesResolver instance since it is stateless 2020-10-26 13:58:45 +01:00
Sam Brannen 9287c15583 Simplify implementation of DefaultActiveProfilesResolver 2020-10-26 13:53:23 +01:00
Sam Brannen 9a4a593c7f Merge branch '5.2.x' 2020-10-26 12:53:53 +01:00
Sam Brannen c840ba9989 Avoid cache miss for @ActiveProfiles w/ same profiles but different order
Prior to this commit, two @ActiveProfiles declarations with the same
profiles but different order resulted in an identical, duplicate
ApplicationContext in the context cache in the Spring TestContext
Framework.

This commit uses a TreeSet to ensure that registered active profiles
are both unique and sorted, thereby avoiding cache misses for
semantically identical active profiles configuration on different test
classes.

Closes gh-25973
2020-10-26 11:42:28 +01:00
Juergen Hoeller 3924947773 Merge branch '5.2.x'
# Conflicts:
#	build.gradle
#	spring-core/src/main/java/org/springframework/util/LinkedMultiValueMap.java
2020-10-26 11:27:05 +01:00
Juergen Hoeller 9d70d2023c Upgrade to SnakeYAML 1.27 2020-10-26 11:16:52 +01:00
Juergen Hoeller 82835b99ec Restore independent LinkedMultiValueMap implementation (without base class)
Closes gh-25960
2020-10-26 11:16:33 +01:00
Juergen Hoeller a3f3a136c4 Make MultiValueMapAdapter public (as base class for LinkedMultiValueMap)
Closes gh-25960
2020-10-26 10:41:59 +01:00
Sébastien Deleuze a2ff03074f Polishing 2020-10-26 09:57:30 +01:00
Sébastien Deleuze a3fcfc5d2a Add SAM conversion example for MockMvcResultHandlersDsl.handle()
See gh-23757
2020-10-26 09:57:30 +01:00
Sam Brannen 1247e4a0e8 Use new ConcurrentLruCache#clear() method in TestContextAnnotationUtils 2020-10-26 09:48:33 +01:00
Rossen Stoyanchev 1676470729 Merge branch '5.2.x' into master 2020-10-26 07:49:51 +00:00
Rossen Stoyanchev 4726663f81 Correct Javadoc link core-resources.adoc
Closes gh-25970
2020-10-26 07:43:30 +00:00
Rossen Stoyanchev 86af93a504 Correct sample in webmvc.adoc
Closes gh-25965
2020-10-26 07:40:33 +00:00
Sébastien Deleuze efe933ad83 Polish Coroutines detection 2020-10-25 18:33:57 +01:00
Sébastien Deleuze 5429c7afeb Support suspending functions annotated with @Transactional
This commit makes TransactionInterceptor and TransactionAspectSupport
Coroutines aware, adapting Reactive transaction support to Coroutines.

Suspending functions returning a Flow are handled like Flux, for other
return types, they are handled like Mono.

Closes gh-23575
2020-10-25 18:33:42 +01:00
Juergen Hoeller 73eefeac5f Expose contains, remove and clear methods on ConcurrentLruCache
Closes gh-25963
2020-10-24 23:48:13 +02:00
Sam Brannen 1a50732daa Attempt to fix failing CI builds 2020-10-24 23:27:18 +02:00
Sam Brannen 1c82ba425b Reduce surface area of public API for AnnotationDescriptor types 2020-10-24 22:45:17 +02:00
Sam Brannen 946e5c9bbf Delete trailing whitespace 2020-10-24 22:29:38 +02:00
Sam Brannen af4d68b1a5 Cache default EnclosingConfiguration mode in TestContextAnnotationUtils 2020-10-24 22:26:29 +02:00
Rossen Stoyanchev a40cc8bbe0 Polishing contribution
Closes gh-25647
2020-10-23 18:27:49 +01:00
Riley Park 6e640c806f Improve support for Content-Disposition types
See gh-25647
2020-10-23 18:16:05 +01:00
Rossen Stoyanchev e66e34766e Support Optional in UriComponentsBuilder#queryParam
Closes gh-25951
2020-10-23 18:09:22 +01:00
Rossen Stoyanchev 5644a7aebb Polishing contribution
Closes gh-25951
2020-10-23 17:43:17 +01:00
Robin Roos 7af726480f Add queryParamIfPresent to UriComponentsBuilder
See gh-25951
2020-10-23 17:07:39 +01:00
Rossen Stoyanchev 51fb49be34 Correct outdated error message 2020-10-23 17:05:00 +01:00
Sam Brannen c524849774 Deleted unused field in DefaultListableBeanFactoryTests 2020-10-23 17:06:26 +02:00
Sam Brannen f2eb67373a Polish TestContextAnnotationUtils 2020-10-23 17:00:39 +02:00
Rossen Stoyanchev cf988f81b5 Merge branch '5.2.x' into master 2020-10-23 15:14:05 +01:00
Arjen Poutsma 417e7e03d4 Introduce RouterFunction attributes
This commit introduces support for router function attributes, a
way to associate meta-data with a route.

Closes: gh-25938
2020-10-23 14:58:49 +02:00
Sam Brannen 8d86d61f9f Introduce TestContextAnnotationUtils to avoid package cycles
This commit introduces TestContextAnnotationUtils as a replacement for
MetaAnnotationUtils, with dedicated support for honoring the new
@NestedTestConfiguration annotation and related annotation search
semantics.

MetaAnnotationUtils has been reverted to its previous scope and is now
deprecated.

See gh-19930
2020-10-23 14:24:33 +02:00
Rossen Stoyanchev fb4363e4e0 Refactor DataBufferUtils Matcher implementation
The existing implementation was exposed to very poor performance when matching
with multiple delimiters against a large buffer with many delimiters. In that
case all matchers are invoked many times (as many as the number of delimiters)
even though some of them found no match at all on the first pass.

The revised implementation uses a single index and advances all matchers
together, checking one byte a time, and not letting any one of them search to
the end of the entire buffer on a single pass.

Closes gh-25915
2020-10-23 13:23:51 +01:00
Juergen Hoeller 1ec6843913 Upgrade CGLIB to ASM9 level as well
See gh-24872
2020-10-23 11:47:03 +02:00
Juergen Hoeller cff57ca1fe Upgrade to R2DBC Arabba-SR8, Jetty 9.4.33, Woodstox 6.2.3, Mockito 3.5.15 2020-10-23 09:30:43 +02:00
Rossen Stoyanchev 784d72cc56 Fix checkstyle violations 2020-10-23 08:22:23 +01:00
Rossen Stoyanchev 4480269432 Upgrade to RSocket 1.1 snapshots
See gh-25956
2020-10-22 21:55:44 +01:00
Rossen Stoyanchev 9a1323aad5 Update StringDecoderBenchmark
See gh-25915
2020-10-22 21:50:27 +01:00