Commit Graph

18629 Commits

Author SHA1 Message Date
Rossen Stoyanchev 06c3a058f4 Use most recent RSocket RC for M2 release 2019-05-08 20:34:22 -04:00
Juergen Hoeller 8b08b6812a Merge branch '5.1.x' 2019-05-09 02:26:23 +02:00
Juergen Hoeller 190b751147 Support any HttpEntity implementing ResolvableTypeProvider
Closes gh-22931
2019-05-09 02:09:31 +02:00
Phillip Webb 798b51f4a3 Migrate to BDD Mockito
Migrate all tests to consistently use BDD Mockito. Also add
checksyle rule to enforce going forwards.
2019-05-08 13:46:13 -07:00
Phillip Webb 816bbee8de Remove '.*' imports from tests
Organize test imports to expand all '.*' static imports into
fully qualified imports.

This update will allow us to use additional checkstyle rules in
the future, and will also help if we migrate fully to AssertJ.
2019-05-08 09:55:09 -07:00
Phillip Webb 1b985fb3da Update static import limit in eclipse prefs
Update eclipse preferences so that static imports no longer use
`.*`.
2019-05-08 09:53:01 -07:00
Phillip Webb 66eb86f055 Delete unused Matchers class
Delete the `Matches` class since it's no longer being used.
2019-05-08 09:52:39 -07:00
Juergen Hoeller c4a95c99e5 Upgrade to Reactor Californium SR7 2019-05-08 18:19:19 +02:00
Juergen Hoeller d3b713d5f0 Upgrade to Protobuf 3.7.1 and HtmlUnit 2.35 2019-05-08 17:52:56 +02:00
Juergen Hoeller fb29088670 Revise LinkedCaseInsensitiveMap's lazy key/value/entry collections
Closes gh-22926
2019-05-08 17:52:28 +02:00
Juergen Hoeller 82d32f0875 Remove unused import 2019-05-08 17:51:54 +02:00
Sam Brannen 4038d590a1 Suppress deprecation warning in Gradle build 2019-05-08 17:18:41 +02:00
Rossen Stoyanchev 44659f4945 Unwrap Part content in asyncPart builder method
Closes gh-22876
2019-05-08 10:59:58 -04:00
Sam Brannen 6a05b97df3 Log identity hash for ApplicationContext for context cache hits/misses
DefaultCacheAwareContextLoaderDelegate now logs the identity hash code
for an application context instance that was stored in or retrieved from
the context cache in the Spring TestContext Framework.

Closes gh-22925
2019-05-08 16:39:23 +02:00
Sam Brannen 4d1637a9b7 Avoid warnings in RequestMappingHandlerMappingTests 2019-05-08 16:29:31 +02:00
Phil Webb d7320de871 Migrate away from ExpectedException (#22922)
* Add limited checkstyles to test code

Add a limited set of checkstyle rules to the test codebase to improve
code consistency.

* Fix checksyle violations in test code

* Organize imports to fix checkstyle for test code

* Migrate to assertThatExceptionOfType

Migrate aware from ExpectedException rules to AssertJ exception
assertions. Also include a checkstyle rules to ensure that the
the ExpectedException is not accidentally used in the future.

See gh-22894
2019-05-08 16:25:52 +02:00
Rossen Stoyanchev 7e6e3d7027 Switch writeAcceptCharset to false by default
Closes gh-22506
2019-05-08 09:56:52 -04:00
Rossen Stoyanchev a9f0eae4ab Merge branch '5.1.x' 2019-05-08 09:41:10 -04:00
Rossen Stoyanchev 6e0dfd6999 Check if Accept-Charset is present before adding it
Closes gh-22506
2019-05-08 09:40:32 -04:00
Sam Brannen 77eef47483 Support automatic constructor injection in JUnit Jupiter
Prior to this commit, dependency injection of all arguments in a test
class constructor invoked by JUnit Jupiter was only possible if the
constructor was explicitly annotated with @Autowired.

This commit introduces support for a configurable "test constructor
autowire" mode which defaults to false in order to remain backwards
compatible.

Specifically, this mode can be configured globally for an entire test
suite via a new "spring.test.constructor.autowire" JVM system property
that can alternatively be configured via the SpringProperties
mechanism. In addition, the global "test constructor autowire" mode can
be overridden locally on a per-class basis via the new @TestConstructor
annotation.

Closes gh-22286
2019-05-08 14:51:43 +02:00
Juergen Hoeller eb16e853b1 Fix JDK 9+ generics compilation problem in TransactionAspectSupport
Includes consistent mentioning of ReactiveTransactionManager in javadoc.

Closes gh-22923
2019-05-08 14:01:12 +02:00
Arjen Poutsma dc01917dae Javadoc 2019-05-08 12:21:00 +02:00
Arjen Poutsma 2352688ccb MultipartIntegrationTests should not bind to same part multiple times
DefaultMultipartMessageReader does not cache the part contents, so
binding to the same part multiple times does not work.
Rewrote this test to use separate HTTP request instead.
2019-05-08 12:10:20 +02:00
Arjen Poutsma e7cca7792d Add way to override default multipartReader
This commit introduces a way to override the default multipart reader,
for instance to the SynchronossPartHttpMessageReader.
2019-05-08 12:10:20 +02:00
Arjen Poutsma 32915d8bf5 Add logging to DefaultMultipartMessageReader 2019-05-08 12:10:20 +02:00
Arjen Poutsma e625ace8c8 Add reference counting for UndertowDataBuffer
This commit adds proper reference counting to the UndertowDataBuffer.
2019-05-08 12:09:16 +02:00
Arjen Poutsma cdd346222c Add reference counting for UndertowDataBuffer
This commit adds proper reference counting to the UndertowDataBuffer.
2019-05-08 11:58:48 +02:00
Rossen Stoyanchev 45147c23c1 Empty body checks in ConsumesRequestCondition
Normally consumes matches the "Content-Type" header but what should be done if
there is no content? This commit adds checks for method parameters with
@RequestBody(required=false) and if "false" then also match requests with no content.

Closes gh-22010
2019-05-07 22:03:36 -04:00
Juergen Hoeller cdf51c3d51 Nullability refinements and related polishing 2019-05-08 00:27:56 +02:00
Juergen Hoeller c5b3848357 Nullability refinements and related polishing
Includes fix for typo in visitor class names.

See gh-22909
2019-05-08 00:27:47 +02:00
Phillip Webb 7031964e49 Deprecate StandardMetadata constructors
Deprecate the public `StandardMetadata` constructors to make it clearer
that these classes should not be instantiated directly. A new
`AnnotationMetadata.introspect` factory method has been added which
can now be used to obtain instances.

This change will allow use to make the constructors package private
and drop the `nestedAnnotationsAsMap` parameter in a future release.

Closes gh-22906
2019-05-07 23:12:42 +02:00
Phillip Webb 7fbf3f97cd Add SimpleAnnotationMeta classes and readers
Replace the existing ASM based readers with new implementations that
also support MergedAnnotations. The meta-data classes themselves are
now immutable, and constructed via separate reader classes.

The `SimpleMetadataReader` class has been updated to return the new
classes, however the old ones remain since some of them are public
and might be being used directly.

Closes gh-22884
2019-05-07 23:12:42 +02:00
Phillip Webb 8c2ccfe6a3 Add MergedAnnotations support to meta-data classes
Add `AnnotatedTypeMetaData.getAnnotations()` that can be used to access
annotation details using the `MergedAnnotations` interface.

Where possible, the existing annotation methods have been migrated to
call `getAnnotation()`, rather than needing their own implementation.

The existing ASM based meta-data implementations have not been updated
since they will be deprecated and replaced in a subsequent commit.

See gh-22884
2019-05-07 23:12:42 +02:00
Phillip Webb 30ba80a3c3 Reduce meta-data code duplicate with default methods
Extract and pull-up some common method implementations and make them
default methods of the interface.

See gh-22884
2019-05-07 23:12:42 +02:00
Phillip Webb f592c1f211 Add additional class/method meta-data tests
Add some additional tests to provide more coverage of class and method
meta-data support.

See gh-22884
2019-05-07 23:12:42 +02:00
Phillip Webb 9738e4886c Use ReflectionUtils to get declared methods
Update `StandardAnnotationMetadata` to use `ReflectionUtils` when
obtaining declared methods. This update is primarily so that the common
method cache can be used.

Closes gh-22907
2019-05-07 23:12:42 +02:00
Phillip Webb 1fa5937834 Skip java.lang.annotations when reading metadata
Update `StandardAnnotationMetadata` and `AnnotationMetadataReadingVisitor`
so that `java.lang.annotation` annotations are consistently skipped.

Closes gh-22885
2019-05-07 23:12:42 +02:00
Phillip Webb 8a293f51a4 Don't expose RetentionPolicy.CLASS annotations
Update ASM based metadata readers so that only RetentionPolicy.RUNTIME
annotations are exposed. This aligned behavior with the reflection based
implementation.

Closes gh-22886
2019-05-07 23:12:42 +02:00
Phillip Webb 9d6cf57cb7 Add MergedAnnotations.of method
Add a factory method to `MergedAnnotation` that allows an instance to
be created for an explicit collection of root annotations. This method
will allow ASM based readers to expose a `MergedAnnotation` instance
that has root annotations loaded from bytecode, and meta-annotations
loaded using reflection.

See gh-22884
2019-05-07 23:12:42 +02:00
Phillip Webb daec3531b3 Support String->Class adaptation in MergedAnnotation
Update TypeMappedAnnotation so that Strings can be used to represent
Class attribute values. This will allow ASM annotation readers to
present a `MergedAnnotation` instance without necessarily having the
actual class values on the classpath.

When the underlying value is a String, any calls to
`getValue(name, String.class)` or `asMap(Adapt.CLASS_TO_STRING)` will
simply return the original String. Calls that need the actual Class
result (such as `getClass`) will use `Class.forName` and may throw
a `ClassNotFoundException` at that point.

This commit also allows an empty Object[] to be used to represent
any empty primitive array.

See gh-22884
2019-05-07 23:12:42 +02:00
Phillip Webb e11990e63d Polishing MergedAnnotation code 2019-05-07 23:12:42 +02:00
Phillip Webb d4a761abea Rename some MergedAnnotation `from` methods to `of`
Rename `from` to `of` for the `MergedAnnotation` factory methods that
work with Maps. The previous name was a little confusing, especially
when an annotation source parameter was specified. The new method name
helps to make it clearer when the user is explicitly defining the
attributes of the annotation, as opposed to picking them up from the
source.
2019-05-07 23:12:42 +02:00
Phillip Webb 3b145a5a73 Add MergedAnnotation.getTypeHierarchy method
Add a `getTypeHierarchy()` method to `MergedAnnotation` that can be used
to return the full type hierarchy information. This method is
specifically designed to be used in combination with
`MergedAnnotationPredicates.unique`.

This update also allows us to delete the `parentAndType` method
from `AnnotatedElementUtils`.

Closes gh-22908
2019-05-07 23:12:42 +02:00
Phillip Webb f86affe404 Extract integration test classes from package-info
Extract the inner classes from package-info into their own files to
prevent local build problems and to make them easier to find.
2019-05-07 23:12:42 +02:00
Juergen Hoeller fff3813d75 Properly detect importing class metadata for lite configuration class
Closes gh-22920
2019-05-07 21:23:47 +02:00
Arjen Poutsma 00a5106bfa Add route(RequestPredicate, HandlerFunction) to RouterFunctions builder
Closes gh-22701
2019-05-07 16:49:02 +02:00
Mark Paluch bb002af8af Fix suspend/resume in AbstractReactiveTransactionManager
We now correctly unwrap suspended resources instead capturing
the Mono emitting suspended resources.

We also properly continue resume by chaining resume Mono's
instead of terminating eagerly.
2019-05-07 15:51:27 +02:00
Arjen Poutsma 55b56b8c5c Javadoc
Closes gh-22893
2019-05-07 15:24:33 +02:00
Arjen Poutsma 59f6044c09 Add route(RequestPredicate, HandlerFunction) to RouterFunctions builder
Closes gh-22701
2019-05-07 15:06:59 +02:00
Johnny Lim 49570ae2f3 Fix typo 2019-05-07 14:25:22 +02:00