Commit Graph

18598 Commits

Author SHA1 Message Date
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
Juergen Hoeller
e3fa4e1350 Merge branch '5.1.x' 2019-05-07 14:24:28 +02:00
Juergen Hoeller
ecc165a94f Consistent spelling on index page 2019-05-07 13:46:27 +02:00
Nicofisi
0e980324e6 Add a space in the documentation index file 2019-05-07 13:29:59 +02:00
Juergen Hoeller
ba1c7192c9 Merge branch '5.1.x' 2019-05-07 13:09:44 +02:00
Juergen Hoeller
46e5dd6420 Consistent handling of empty List entries in LinkedMultiValueMap
Closes gh-22912
2019-05-07 13:08:42 +02:00
Sam Brannen
ccb01e663a Merge branch '5.1.x' 2019-05-07 13:03:45 +02:00
Sam Brannen
4aaec942c4 Introduce HTTPS mappings in spring.schemas files
Closes gh-22903
2019-05-07 12:56:42 +02:00
Juergen Hoeller
7e5aacf8a2 Merge pull request #22421 from olszewskimichal/LinkedMultiValueMap-OutOfBoundException-When-EmptyList
LinkedMultiValueMap.getFirst - check that values is not empty
2019-05-07 12:44:05 +02:00
Juergen Hoeller
8eb9782ca2 Polishing 2019-05-07 12:43:36 +02:00
Arjen Poutsma
fb642ce723 Introduce DefaultMultipartMessageReader
This commit introduces the DefaultMultipartMessageReader, a fully
reactive multipart parser that does have any third party dependencies.

Closes gh-21659
2019-05-07 12:14:45 +02:00
Arjen Poutsma
f747ba282a Add DataBufferUtils.matcher and split
Added two methods to DataBufferUtils:

* matcher(byte[]), which returns a Matcher object that can be used to
  find a delimiter in a data buffer.
* split(Publisher<DataBuffer>, byte[] delimiter), which splits a given
  stream of data buffers around a given delimiter.
2019-05-07 12:14:45 +02:00
Arjen Poutsma
b74c09d12e Add DataBuffer.retainedSlice
Add method retainedSlice to the DataBuffer, defaulting to using
DataBufferUtils for retain, but allowing for ByteBuf specific override.
2019-05-07 12:14:45 +02:00
Mark Paluch
1d80cbea35 Replace signal materialization in TransactionAspectSupport with usingWhen
We now use Flux.usingWhen() instead materialize/dematerialize operators
to reuse Reactor's resource closure.

Until usingWhen() accepts a BiFunction to consume error signals,
we need to map error signals outside of usingWhen which requires
re-wrapping of the ReactiveTransaction object.

Also, reuse the current TransactionContext to leave Transaction
creation/propagation entirely to ReactiveTransactionManager instead
of creating new TransactionContexts.
2019-05-07 11:23:20 +02:00
Juergen Hoeller
28c5d7b586 Merge branch '5.1.x' 2019-05-07 02:12:11 +02:00
Juergen Hoeller
053b95ceeb Refer to non-deprecated Jackson 2.5+ addMixIn method in javadoc 2019-05-07 02:06:40 +02:00
Stephane Maldini
d45f7c4828 Use explicit onErrorMap(class.java) instead of reactor kotlin extension 2019-05-06 16:45:01 -07:00
Juergen Hoeller
d16beb0e55 Polishing
See gh-22900
2019-05-07 01:40:53 +02:00
Juergen Hoeller
85cecb66e5 Consistent parameter retrieval across InvocableHandlerMethod variants
See gh-22900
2019-05-07 01:33:07 +02:00
Juergen Hoeller
f56c70d2f0 Merge branch '5.1.x' 2019-05-07 01:23:16 +02:00
Stephane Maldini
fd36d1efe6 Use explicit expectError(class.java) instead of reactor kotlin extension 2019-05-06 16:22:25 -07:00
Juergen Hoeller
c841b62bb0 Consistent parameter retrieval across InvocableHandlerMethod variants
See gh-22900
2019-05-07 01:20:05 +02:00
Stephane Maldini
3f8be3416e Use explicit cast to avoid dependency on reactor-core kotlin extension 2019-05-06 16:13:05 -07:00
Juergen Hoeller
30a1f6fed5 Consistent exception naming across InvocableHandlerMethod variants
See gh-22900
2019-05-07 01:00:45 +02:00
Juergen Hoeller
4b06d8e511 Merge branch '5.1.x' 2019-05-07 00:59:56 +02:00
Juergen Hoeller
3f85a7db1b Consistent exception naming across InvocableHandlerMethod variants
See gh-22900
2019-05-07 00:48:27 +02:00
Juergen Hoeller
379d81da74 Consistent thread-safe handling of manualSingletonNames Set
Closes gh-22896
2019-05-07 00:47:59 +02:00
Ippei Nawate
47ff92873b Add null check 2019-05-07 00:23:48 +02:00
Sebastien Deleuze
2b3df1fa30 Merge branch '5.1.x' 2019-05-06 22:11:11 +02:00
Sebastien Deleuze
4b31feb243 Clarify Jackson2ObjectMapper.modules(ToInstall) semantics
Closes gh-22747
2019-05-06 22:09:56 +02:00
Rossen Stoyanchev
53cadf15e7 Deferred handling of Flux error in Spring MVC
This commit defers flushing of the response until the first item is
emitted that needs to be written (and flushed) to the response.

This makes Spring MVC consistent with WebFlux in this regard.

Closes gh-21972
2019-05-06 12:26:25 -04:00
Rossen Stoyanchev
15e1af2281 Protected methods to determine payload target type
Closes gh-22035
2019-05-06 09:34:21 -04:00