Commit Graph

18104 Commits

Author SHA1 Message Date
Phillip Webb a57d6ba5f3 Optimize StringUtils.cleanPath
Add an early exit to `StringUtils.cleanPath` to save array creating and
string concatenation. With a typical Spring application, the `cleanPath`
method can be called over 600 times, often with a path constructed by
a `ClassPathResource` that is likely to already be clean.

Closes gh-22568
2019-03-22 20:40:05 +01:00
Phillip Webb 19fb697d03 Add more empty array constants in ReflectionUtils
Add some additional empty array constants to `ReflectionUtils` to save
us creating new arrays for zero length results.

See gh-22567
2019-03-22 20:40:05 +01:00
Phillip Webb e3a86be122 Make ConcurrentReferenceHashMap more JIT friendly
Update `ConcurrentReferenceHashMap` to make some methods more inline
friendly, and to manually inline a few others. These minor optimizations
don't make a great deal of difference for most applications, but seem
worthwhile since we use `ConcurrentReferenceHashMap` for many internal
caches.

Closes gh-22566
2019-03-22 20:40:05 +01:00
Phillip Webb aa4e56b251 Optimize @Configuration class parsing a little
Update `ConfigurationClassParser` to skip `java.lang.annotation` types
which were often processed but would never provide useful results. Also
use a single shared immutable `SourceClass` instance to represent
`Object.class`.

Closes gh-22563
2019-03-22 20:40:05 +01:00
Phillip Webb 37255afca4 Complete migration of annotation utility methods
Delete `InternalAnnotationUtils` and `InternalAnnotatedElementUtils` and
migrate exclusively to the new `MergedAnnotations` API.

Closes gh-22562
2019-03-22 20:40:05 +01:00
Phillip Webb a14bfe9a21 Migrate and verify annotation utility methods
Migrate all possible `AnnotationUtils` and `AnnotatedElementUtils`
method to the `MergedAnnotation` API, verify results against the old
implementations.

All migrated methods now call both the new API and the old version and
ensure that the same results or exceptions are raised. A full build of
both Spring Framework and Spring Boot has been executed to ensure, as
much as possible, that the migration does not cause unexpected
regressions.

See gh-22562
2019-03-22 20:40:05 +01:00
Phillip Webb b91ccf038f Start migration annotation utility methods
Create internal variants of the existing `AnnotationUtils` and
`AnnotatedElementUtils` classes and migrate the existing classes to
use them.

The internal variants will be used to check that the same results are
given as we migrate the utils methods to use the new `MergedAnnotations`
API.

See gh-22562
2019-03-22 20:40:05 +01:00
Phillip Webb 4972d85ae0 Create a new API for handling merged annotations
Add new `MergedAnnotations` and `MergedAnnotation` interfaces that
attempt to provide a uniform way for dealing with merged annotations.

Specifically, the new API provides alternatives for the static methods
in `AnnotationUtils` and `AnnotatedElementUtils` and supports Spring's
comprehensive annotation attribute `@AliasFor` features. The interfaces
also open the possibility of the same API being exposed from the
`AnnotationMetadata` interface.

Additional utility classes for collecting, filtering and selecting
annotations have also been added.

Typical usage for the new API would be something like:

	MergedAnnotations.from(Example.class)
		.stream(MyAnnotation.class)
		.map(a -> a.getString("value"))
		.forEach(System.out::println);

Closes gh-21697
2019-03-22 20:40:05 +01:00
Phillip Webb fdacda8b01 Add AnnotationIntrospectionFailureTests
Add a new test class to help cover annotation introspection failure
handling. These tests were previously missing and are important to
ensure that annotation util code changes don't introduce regressions.

See gh-21697
2019-03-22 20:40:05 +01:00
Phillip Webb 8ef609a1b7 Add public variant getDeclaredMethods method
Add a public variant of `getDeclaredMethods` that defensively copies the
cached methods array. This is often more faster and more convenient
for users than calling `doWithLocalMethods`. We still retain most of the
benefits of the cache, namely fewer security manager calls and not as
many `Method` instances being created.

Closes gh-22580
2019-03-22 20:40:05 +01:00
Phillip Webb 5044ee8fe6 Add AssertJ dependency for tests usage
Add AssertJ as a test scope dependency for all sub-projects.

Closes gh-22561
2019-03-22 20:40:05 +01:00
Phillip Webb ecbad874bf Refine eclipse settings 2019-03-22 20:40:05 +01:00
Phillip Webb 9c92b21af8 Polishing 2019-03-22 20:40:05 +01:00
Rossen Stoyanchev f8121515bf Merge branch '5.1.x' 2019-03-22 14:50:51 -04:00
Rossen Stoyanchev c9a86e1ff4 Polish
See gh-22598
2019-03-22 14:39:21 -04:00
wenqi.huang d10174a3e9 Optimize performance of produces condition checks 2019-03-22 13:59:34 -04:00
Sam Brannen 14902e1744 Polish Javadoc 2019-03-22 13:32:24 +01:00
arman simonyan 517812d30a Fix grammar issue 2019-03-22 09:25:21 +01:00
Rossen Stoyanchev 2f95859715 Upgrade to RSocket 0.12.1-RC3-SNAPSHOT
Closes gh-22629
2019-03-21 19:31:06 -04:00
armansimonyan13 3e4f8905a7 Fix grammar issue (#22628) 2019-03-21 19:32:10 +01:00
Sebastien Deleuze 5a0ac42b85 Merge branch '5.1.x' 2019-03-21 19:17:22 +01:00
Sebastien Deleuze d4714847a0 Restore 2 digit days format in HttpHeaders
As recommended by RFC 7231, this commit restore using 2 digit days
when formatting dates while still using
DateTimeFormatter.RFC_1123_DATE_TIME for parsing.

Closes gh-22478
2019-03-21 18:31:45 +01:00
Sebastien Deleuze 0d8fbb4c65 Merge branch '5.1.x' 2019-03-21 11:34:10 +01:00
Sebastien Deleuze 35010149f8 Fix Jackson builder modulesToInstall override behavior
This commit updates Jackson2ObjectMapperBuilder in order
to ensure that modules specified via modulesToInstall
eventually override the default ones.

Closes gh-22576
2019-03-21 11:24:03 +01:00
arman simonyan b7f5d1f031 Fix grammar issues 2019-03-21 10:05:31 +01:00
Rossen Stoyanchev 4938831575 Register custom before default codecs
Closes gh-22612
2019-03-20 20:52:57 -04:00
Rossen Stoyanchev e9819b7535 Raise ISE if @RequestBody is used for form data
Closes gh-22486
2019-03-20 20:30:36 -04:00
Arjen Poutsma b67039d19a Fix checkstyle issue 2019-03-20 20:29:43 +01:00
Rossen Stoyanchev 2e7f98d7f6 Merge branch '5.1.x' 2019-03-20 14:47:02 -04:00
Rossen Stoyanchev c6a655275d Allow overriding of FormHttpMessageWriter#getMediaType
Closes gh-22588
2019-03-20 14:46:38 -04:00
Arjen Poutsma 0e9ea2c94d Fix review remarks on Servlet.fn
This commit incoporates the remarks made during the Servlet.fn review.

See gh-21490
2019-03-20 16:47:50 +01:00
Arjen Poutsma 2f682e1035 Polishing 2019-03-20 16:47:27 +01:00
Arjen Poutsma e638fef508 Add Servlet.fn integration with DispatcherServlet
This commit adds support for HandlerFunctions and RouterFunctions to
DispatcherServlet, in the form of a HandlerAdapter and HandlerMapping.

See gh-21490
2019-03-20 16:47:27 +01:00
Arjen Poutsma 85082fc10c Add Tests for Servlet.fn
This commit adds tests for Servlet.fn, the servlet-based version of
HandlerFunctions and RouterFunctions.

See gh-21490
2019-03-20 16:47:27 +01:00
Arjen Poutsma 5d2fd75cf9 Introduce Servlet.fn
This commit introduces Servlet.fn, a servlet-based version of
WebFlux.fn, i.e. HandlerFunctions and RouterFunctions.

This commit contains the web framework only, further commits provide
tests and DispatcherServlet integration.

See gh-21490
2019-03-20 16:47:27 +01:00
Rossen Stoyanchev 5f111098b1 Check for Reactor Netty disconnected client errors
Extend the list of disconnected client errors in HttpWebHandlerAdapter
to include the Reactor Netty AbortedException as well exceptions with
the message "connection reset by peer".

Closes gh-21790
2019-03-20 09:01:22 -04:00
Sam Brannen 7d498ba681 Fix Checkstyle error and polish Javadoc for ResourceHttpMessageReader 2019-03-20 11:03:54 +01:00
Rossen Stoyanchev 4a397f108a ResourceDecoder supports filename hint
Closes gh-22267
2019-03-19 17:50:06 -04:00
Rossen Stoyanchev 5a3ff35215 Map arg resolver backs out if annotations present
Closes gh-21874
2019-03-19 16:41:26 -04:00
Rossen Stoyanchev a2fcf0a821 ReactorNettyWebSocketSession uses correct frame size
See gh-22367
2019-03-19 15:42:06 -04:00
Rossen Stoyanchev 48ec875a7f Merge branch '5.1.x' 2019-03-19 14:41:00 -04:00
Rossen Stoyanchev c7401dbe1f Fix @since typo 2019-03-19 14:40:34 -04:00
Rossen Stoyanchev 581e77c0fb Merge branch '5.1.x' 2019-03-19 14:18:52 -04:00
Rossen Stoyanchev f52c1fda3b Polish 2019-03-19 14:18:33 -04:00
Sam Brannen 3e2dbd03b9 Merge branch '5.1.x' 2019-03-19 19:00:12 +01:00
Sam Brannen ef11aa4583 Update documentation for WebJar support
Prior to this commit, documentation for WebJar support referenced the
webjars-locator artifact; however, Spring now uses the
webjars-locator-core artifact.

This commit updates the documentation to reflect this.

Closes gh-22613
2019-03-19 18:59:03 +01:00
Sam Brannen 2bbd52c9f3 Polishing 2019-03-19 18:46:05 +01:00
Arjen Poutsma 228cae216e Merge branch '5.1.x' 2019-03-19 11:30:43 +01:00
Arjen Poutsma 4651039b1f Use ChannelListener for Undertow zero-copy file transfers
This commit changes the UndertowServerHttpResponse to use a
listener-based approach instead of a blocking approach.

Closes gh-22413
2019-03-19 11:16:42 +01:00
Sam Brannen 0fc0849c0a Upgrade to JUnit Jupiter 5.4.1
Closes gh-22308
2019-03-17 23:01:44 +01:00