Commit Graph

696 Commits

Author SHA1 Message Date
Rossen Stoyanchev 0fb31c5e36 Refine "." separator support for STOMP messaging
After this commit DefaultUserDestinationResolves no longer looks at
whether AntPathMatcher is configured with "." as separator and rather
expects to be explicitly told whether to keep the leading slash in
translated destinations which actually depends on what the message
broker supports (e.g. RabbitMQ "/", Artemis ".") or how it is
configured (simple broker could be either way).

There is also a minor improvement in SimpMessagingTemplate to ensure
user destinations are correctly formed based on what the
DefaultUserDestinationResolver expects. When using "." as separtor it
allows sending messages to "queue.q1" rather than "/queue.q1".

Issue: SPR-16275
2018-01-19 21:02:43 -05:00
Rossen Stoyanchev 17f9b61249 Polish MessageBrokerConfigurationTests 2018-01-19 21:02:43 -05:00
Rossen Stoyanchev 583201b02c MappingJackson2MessageConverter uses generic type
Issue: SPR-16252
2017-12-12 22:32:33 -05:00
Rossen Stoyanchev f736b665bd Fix compile issue from previous commit 2017-12-11 16:37:11 -05:00
Rémi Alvergnat 76dcde9e31 Fix Stomp Broker Relay ignoring destination prefixes in some cases
Issue: SPR-16265
2017-12-11 13:25:29 -08:00
Christoph Dreis f4e9fb52a8 Reduce access on user in SimpleBrokerMessageHandler.handleMessageInternal
Issue: SPR-16264
2017-12-05 11:18:02 +01:00
Christoph Dreis 9fab208fdd Reduce access on headers for STOMP messaging
Issue: SPR-16165
2017-11-06 20:19:00 +01:00
Juergen Hoeller 9b7af8b5aa Polishing 2017-11-05 21:07:26 +01:00
Rossen Stoyanchev abe4420006 Improve ReactorNettyTcpClient shutdown logic
This commit takes care of the TODOs in ReactorNettyTcpClient by taking
advantage of improvements in Reactor Netty.

Issue: SPR-16145
2017-11-01 16:34:32 -04:00
Rossen Stoyanchev b35b50bef1 Polish 2017-11-01 09:21:36 -04:00
Rossen Stoyanchev 64bc9b4311 Do match message type
SimpMessageTypeMessageCondition was lenient in matching the message
type, essentially matching on any non-null message type with an exact
match given a preference only in comparing mulitple matches.

This commit modifies matching logic to look for an exact match.

Issue: SPR-16109
2017-11-01 09:21:36 -04:00
Juergen Hoeller 9bab7a2708 Upgrade to Java Activation Framework 1.2 for test runtime
Includes upgrade to Hibernate Validator 6.0.4 (where applicable)

Issue: SPR-16115
2017-10-25 19:18:10 +02:00
Rossen Stoyanchev 1cc5afe24b Fix lines over 120 characters
https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-Code-Style#line-wrapping
2017-10-20 16:42:26 -04:00
Tom Fitzhenry 1fe3e0cd06 Fix typo in exception message: quite -> quiet
Closes gh-1547
2017-10-03 08:24:34 +02:00
Juergen Hoeller efce7902c4 Polishing 2017-09-27 01:34:11 +02:00
Juergen Hoeller e2882fe1db Build against EE 8 API level wherever possible
Upgrade to JAXB 2.3, JAX-WS 2.3, Annotations 1.3.1, Interceptor 1.2.1.
Also includes Log4J 2.9.1 and Asciidoctor 1.5.6.
2017-09-24 17:18:21 +02:00
Juergen Hoeller 9190b76ab9 Latest dependency updates (POI 3.17, Rome 1.8, EhCache 3.4, Caffeine 2.5.6, RxJava 2.1.4, Tomcat 8.5.21, JRuby 9.1.13, Rhino 1.7.7.2) 2017-09-23 11:28:19 +02:00
Juergen Hoeller 7ae59d0c2a Nullability refinements on private and static methods
Based on IntelliJ IDEA 2017.3 introspection results.

Issue: SPR-15756
2017-09-22 18:22:14 +02:00
Juergen Hoeller ac9cfefaff TaskExecutorRegistration does not apply its default settings to a user-provided executor
Also, ChannelRegistration.setInterceptors is deprecated now: in favor of a fluently named interceptors(...) method which is documented to add the given interceptors to the channel's current list.

Issue: SPR-15962
Issue: SPR-15976
2017-09-19 13:47:43 +02:00
Juergen Hoeller 3bd2154046 Polishing 2017-09-19 00:02:40 +02:00
Sebastien Deleuze 1bc93e3d0f Revisit nullability annotations
This commit introduces the following changes.

1) It adds a new Spring @NonNull annotation which allows to apply
@NonNullApi semantic on a specific element, like @Nullable does.
Combined with @Nullable, it allows partial null-safety support when
package granularity is too broad.

2) @Nullable and @NonNull can apply to ElementType.TYPE_USE in order
to be used on generic type arguments (SPR-15942).

3) Annotations does not apply to ElementType.TYPE_PARAMETER anymore
since it is not supported yet (applicability for such use case is
controversial and need to be discussed).

4) @NonNullApi does not apply to ElementType.FIELD anymore since in a
lot of use cases (private, protected) it is not part for the public API
+ its usage should remain opt-in. A dedicated @NonNullFields annotation
has been added in order to set fields default to non-nullable.

5) Updated Javadoc and reference documentation.

Issue: SPR-15756
2017-09-15 13:26:41 +02:00
Juergen Hoeller aa4ae7a750 Heart-beat log message potentially without session id
Issue: SPR-15937
2017-09-08 16:55:27 +02:00
Rossen Stoyanchev 39cefb5bd7 One more instance of modified method name in Mono 2017-09-05 13:59:45 -04:00
Juergen Hoeller 97ded1dcc7 Polishing 2017-09-01 14:05:35 +02:00
Juergen Hoeller 2b44e6e21c Strong references to mapped exception handler methods
Issue: SPR-15907
2017-08-29 15:07:23 +02:00
Brian Clozel 397fd24849 Revert "Leverage Kotlin plugin dependency management"
This reverts commit 3e2f6c848a.
2017-08-22 21:29:39 +02:00
Sebastien Deleuze 3e2f6c848a Leverage Kotlin plugin dependency management 2017-08-22 17:35:57 +02:00
Brian Clozel cc3d7d2d48 Apply dependency management to selected modules
This commit applies the Dependency Management Plugin to modules that
require it; right now Spring Framework is importing BOMs for Netty and
Reactor dependencies only.

Instead of applying those BOMs to all modules, they're applied only
where they're needed.

Issue: SPR-15885
2017-08-21 14:42:03 +02:00
Brian Clozel 2eeb428e95 Move modules to independent build files
The main `build.gradle` file contains now only the common build
infrastructure; all module-specific build configurations have
been moved to their own build file.

Issue: SPR-15885
2017-08-21 14:41:55 +02:00
Juergen Hoeller fac1f236c3 Upgrade to Servlet API 4.0 for MVC and merge EhCache 3 tests into spring-context-support
Includes general streamlining of dependency declarations with reduced version variables, direct use of EclipseLink 2.7 and its implicit JPA 2.2 dependency in spring-orm, mixed use of Hibernate 5.2.10 and 5.1.10 for integration tests, as well as an upgrade to Jetty 9.4.7 RC0 and a downgrade to Groovy 2.4.12 (since Groovy 2.5 won't be final in time for Spring Framework 5.0).

Issue: SPR-15879
Issue: SPR-15880
2017-08-21 01:34:11 +02:00
Stephane Nicoll f6e7fef236 Polish 2017-08-19 10:50:41 +02:00
Juergen Hoeller b94302b5bd Enforce non-null value from getBean and at injection points
Bean-derived null values may still get passed into bean properties and injection points but only if those are declared as non-required. Note that getBean will never return null; a manual bean.equals(null) / "null".equals(bean.toString()) check identifies expected null values now.  This will only ever happen with custom FactoryBeans or factory methods returning null - and since all common cases are handled by autowiring or bean property values in bean definitions, there should be no need to ever manually check for such a null value received from getBean.

Issue: SPR-15829
2017-08-18 00:11:35 +02:00
Sebastien Deleuze 73cf07e9a4 Fix overridden methods nullability
Issue: SPR-15869
2017-08-17 15:02:59 +02:00
Juergen Hoeller adeb521ce4 Polishing 2017-08-08 17:27:28 +02:00
Sebastien Deleuze ed6fe2b723 Upgrade to Kotlin 1.1.4-eap-33
Issue: SPR-15814
2017-07-24 17:29:02 +02:00
Juergen Hoeller 46eba3dbfa Nullability fine-tuning around declaration inconsistencies
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 22:22:20 +02:00
Juergen Hoeller 9fc4fb10b0 Nullability fine-tuning around bean properties
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 11:43:58 +02:00
Sebastien Deleuze fb4ddb0746 Make getters and setters null-safety consistent
This commit ensure that null-safety is consistent between
getters and setters in order to be able to provide beans
with properties with a common type when type safety is
taken in account like with Kotlin.

It also add a few missing property level @Nullable
annotations.

Issue: SPR-15792
2017-07-19 09:07:56 +02:00
Rossen Stoyanchev 095cc2283e Replace constant from QueueSupplier with local one 2017-07-13 22:07:19 +02:00
Juergen Hoeller 5f767a86f5 Always invoke Jackson serialization with AtomicReference cause
Issue: SPR-15760
2017-07-12 19:13:03 +02:00
Alan Hong fc7e7a3304 Fix typo
closes gh-1465
2017-07-12 17:12:34 +02:00
Juergen Hoeller 122ee3096c Efficient log checks in STOMP encoder/decoder 2017-07-10 20:44:51 +02:00
Violeta Georgieva fd1859c34c Adapt to the changes in Reactor Netty ClientOptions
ClientOptions/HttpClientOptions are now created via Builder
2017-07-04 15:26:29 +02:00
Juergen Hoeller cc74a2891a @Nullable all the way: null-safety at field level
This commits extends nullability declarations to the field level, formalizing the interaction between methods and their underlying fields and therefore avoiding any nullability mismatch.

Issue: SPR-15720
2017-06-30 01:54:16 +02:00
Juergen Hoeller 7e251274ee Consistent nullability of headers Map and MessagePostProcessor
Issue: SPR-15670
2017-06-15 22:45:06 +02:00
Stephane Nicoll 1ab678a2a3 Polish "Refactor iterator of Map with Java8's Map.forEach"
Closes gh-1459
2017-06-13 16:06:20 +02:00
diguage 1ef5f61ab2 Refactor iterator of Map with Java8's Map.forEach
See gh-1459
2017-06-13 16:06:20 +02:00
Juergen Hoeller 7dd8dc62a5 Fixes for ignored tests after last week's nullability commit
Issue: SPR-15540
2017-06-13 11:37:58 +02:00
Stephane Nicoll 58242f2249 Polish 2017-06-13 10:13:14 +02:00
Stephane Nicoll fc64b8040f Polish "Replace relevant code with lambda"
Closes gh-1454
2017-06-13 09:42:20 +02:00
diguage 4b1478d830 Replace relevant code with lambda
See gh-1454
2017-06-13 08:55:38 +02:00
Arjen Poutsma 9bf82dc18f Add addAll(MultiValueMap)
This commit introduces a new method for MultiValueMap: addAll, which
adds all values of a given map (cf putAll, which replaces existing
values).
2017-06-12 14:12:12 +02:00
diguage c1d44d9a34 Use the diamond syntax
Closes gh-1450
2017-06-12 09:19:06 +02:00
Rob Winch b1345014b9 Update to Reactor Bismuth-M2
Issue: SPR-15646
2017-06-09 09:49:31 -05:00
Juergen Hoeller fd53d2a51a Consistent use of @Nullable in spring-test
This commit also removes nullability from two common spots: ResolvableType.getType() and TargetSource.getTarget(), both of which are never effectively null with any regular implementation. For such scenarios, a non-null empty type/target is the cleaner contract.

Issue: SPR-15540
2017-06-08 22:52:59 +02:00
Juergen Hoeller 7eaedf2916 Debug-level log entry for any Jackson exception during canConvert
Issue: SPR-15582
2017-06-07 18:33:19 +02:00
Juergen Hoeller f813712f5b Consistent use of @Nullable across the codebase (even for internals)
Beyond just formally declaring the current behavior, this revision actually enforces non-null behavior in selected signatures now, not tolerating null values anymore when not explicitly documented. It also changes some utility methods with historic null-in/null-out tolerance towards enforced non-null return values, making them a proper citizen in non-null assignments.

Some issues are left as to-do: in particular a thorough revision of spring-test, and a few tests with unclear failures (ignored as "TODO: NULLABLE") to be sorted out in a follow-up commit.

Issue: SPR-15540
2017-06-07 14:19:15 +02:00
Rossen Stoyanchev 4a3f6e4546 Polish 2017-05-31 22:43:25 -04:00
Christoph Dreis 0ef1623643 Optimize DefaultUserDestinationResolver.resolveDestination()
Issue: SPR-15602
2017-05-31 22:37:42 -04:00
Sebastien Deleuze 1f28825f9d Add more @Nullable parameters based on null usage
Issue: SPR-15540
2017-05-31 21:42:23 +02:00
Gary Russell f9b319d3ba Revert Incorrect MessagingTemplate Change
The change to "optimize" the template by not rebuilding the reply
message when the original header channels was null was incorrect.

We need to null out those headers if they were originally null.

Issue: SPR-15991
2017-05-31 15:12:46 -04:00
Sebastien Deleuze b47d713e14 Add missing @Nullable annotations on parameters
Issue: SPR-15540
2017-05-31 16:56:08 +02:00
Gary Russell e06c4d5116 Timeout Overrides in Messaging Templates
Provide a mechanism to override the configured send and receive
timeouts in the GenericMessagingTemplate.

- overload `doReceive()` to take a receive timeout argument
- for `sendAndReceive()` methods examine message headers for these
  timeout values
  - remove headers to avoid propagation
  - avoid the unconditional rebuild of the reply message if the
    original headers weren't present
- also remove headers from simple `send()` operations
- change javadocs for the setters to indicate they are now defaults
- add properties to allow the user to override the header names used
- change `TemporaryReplyChannel` to use `send` arg and change to static
  - add package-protected ctor to avoid the compiler creating a
    synthetic constructor for access

Issue: SPR-15591
2017-05-30 17:03:46 -04:00
Sebastien Deleuze 87598f48e4 Introduce null-safety of Spring Framework API
This commit introduces 2 new @Nullable and @NonNullApi
annotations that leverage JSR 305 (dormant but available via
Findbugs jsr305 dependency and already used by libraries
like OkHttp) meta-annotations to specify explicitly
null-safety of Spring Framework parameters and return values.

In order to avoid adding too much annotations, the
default is set at package level with @NonNullApi and
@Nullable annotations are added when needed at parameter or
return value level. These annotations are intended to be used
on Spring Framework itself but also by other Spring projects.

@Nullable annotations have been introduced based on Javadoc
and search of patterns like "return null;". It is expected that
nullability of Spring Framework API will be polished with
complementary commits.

In practice, this will make the whole Spring Framework API
null-safe for Kotlin projects (when KT-10942 will be fixed)
since Kotlin will be able to leverage these annotations to
know if a parameter or a return value is nullable or not. But
this is also useful for Java developers as well since IntelliJ
IDEA, for example, also understands these annotations to
generate warnings when unsafe nullable usages are detected.

Issue: SPR-15540
2017-05-27 08:57:01 +02:00
Rossen Stoyanchev b6e252495a Protect against NPE in DefaultSubscriptionRegistry
Follow-up fix on the recent commit:
https://github.com/spring-projects/spring-framework/commit/44c31a

Issue: SPR-15543
2017-05-22 16:08:34 -04:00
Bao Tran 44c31a6aad Fix duplicate STOMP subscription id issue
Issue: SPR-15543
2017-05-19 15:20:14 -04:00
Juergen Hoeller 9e3f4ccce9 Merge pull request #1394 from alexander-riss/keySet
Fix inefficient use of keySet operators in messaging classes

Issue: SPR-15553
2017-05-16 11:22:22 +02:00
Alexander Riss e49a5d8424 fix inefficient use of keySet operators in messaging classes
issue: SPR-15553
2017-05-16 10:41:22 +02:00
Juergen Hoeller e93e49f268 ErrorMessage.toString() includes original message at top level
Issue: SPR-15459
2017-04-19 20:50:20 +02:00
Gary Russell e677342628 Add originalMessage to ErrorMessage
Issue: SPR-15459
2017-04-19 14:04:25 -04:00
Sebastien Deleuze 4d9144132e Upgrade to Reactor Core 3.1
Issue: SPR-15318
2017-04-11 18:13:04 +02:00
Juergen Hoeller 5986f881d0 HandlerMethod evaluates ResponseStatus annotation for early caching
Issue: SPR-15227
2017-04-08 15:56:05 +02:00
Brian Clozel b799013567 Update to Reactor Aluminium SNAPSHOT
Currently the BOM versions are:

* reactor-core 3.0.6.BUILD-SNAPSHOT
* reactor-netty 0.6.2.BUILD-SNAPSHOT

This commit fixes as well a few deprecations in reactor-core.
2017-03-10 15:20:40 +01:00
stonio 7d062df992 Use String#isEmpty()
Closes gh-1335
2017-02-22 11:55:17 +01:00
Juergen Hoeller d2cc97af47 Polishing 2017-02-21 22:41:40 +01:00
Rossen Stoyanchev f219680d42 Add equals/hashcode for STOMP Subscription
Issue: SPR-15229
2017-02-21 15:05:06 -05:00
Stephane Maldini ba97432043 prepare for reactor-netty 0.6.1.RELEASE 2017-02-21 16:00:19 +00:00
Juergen Hoeller 370e3d683a Polishing 2017-02-20 23:00:12 +01:00
Juergen Hoeller 74bdcd8ed4 MutableMessageHeaders serializes itself as regular MessageHeaders
Issue: SPR-15262
2017-02-17 20:59:17 +01:00
Juergen Hoeller 50d93d3794 Consistently support CompletionStage next to CompletableFuture
Issue: SPR-15258
2017-02-15 23:16:11 +01:00
Rossen Stoyanchev 60517b23e2 StompSession supports custom headers for UNSUBSCRIBE
Issue: SPR-15131
2017-01-31 17:55:53 -05:00
Juergen Hoeller 9b26fcd7d2 Refined assertion messages
Issue: SPR-15196
2017-01-31 15:56:39 +01:00
Juergen Hoeller 1b2dc3638f Revisit Assert to avoid single-arg assert methods (with refined messages)
Issue: SPR-15196
2017-01-30 22:15:55 +01:00
Arjen Poutsma 69c16f3821 Add headers in InterceptingClientHttpRequest
This commit *adds* the "intercepted" headers to the ClientHttpRequest,
as opposed to replacing them, which is what happened before this commit.

Issue: SPR-15166
2017-01-30 14:18:50 +01:00
Juergen Hoeller 8038fb9c8b HandlerMethod pre-resolves parameter types at construction time
Issue: SPR-15186
2017-01-25 11:09:43 +01:00
Juergen Hoeller 12973ac702 Polishing 2017-01-24 00:12:53 +01:00
Juergen Hoeller f095aa20eb Polishing 2017-01-23 21:28:40 +01:00
Juergen Hoeller e9db4d6f96 Proper resolution of Optional.empty() for header arguments
Issue: SPR-15151
2017-01-17 10:46:37 +01:00
Juergen Hoeller 62e530ec94 Resolve minor 4.3.x deprecations in master
Issue: SPR-15139
2017-01-16 21:43:12 +01:00
Juergen Hoeller 047786acef Revised InvocableHandlerMethod exception messages (controller vs endpoint vs handler)
Introduces dedicated MethodArgumentResolutionException for spring-messaging invocations.

Issue: SPR-15139
2017-01-16 21:14:46 +01:00
Juergen Hoeller 7c05b427a7 MimeTypeUtils constants cleanup: removed web media types
Issue: SPR-15137
2017-01-12 23:30:57 +01:00
Juergen Hoeller 743ce2cda6 Polishing 2017-01-12 23:30:38 +01:00
Sam Brannen 9ed66bf2eb Clean up warnings across code base 2017-01-07 01:54:38 +01:00
Gary Russell 80bc8fc596 Implement MessagingException.toString()
Issue: SPR-15091
Closes gh-1284
2017-01-05 10:25:04 +01:00
Rossen Stoyanchev e62b104e03 Resource cleanup on shutdown in ReactorNettyTcpClient 2016-12-28 21:37:12 -05:00
Rossen Stoyanchev 698c885e06 Reconnect failures delegated to TcpConnectionHandler
When connecting with a ReconnectStrategy we can only report the outcome
of the first connect to the ListenableFuture<Void> return value.

Failures for all subsequent attempts to reconnect however must be
channeled to TcpConnectHandler#afterConnectFailure which is used in
the STOMP broker relay for example to publish
BroadcastAvailability(true/false) events.
2016-12-28 21:37:07 -05:00
Rossen Stoyanchev ea274ebc0a Fix decoding issue in Reactor TcpClient
When decoding STOMP messages unread portions of a given input ByteBuf
must be kept until more input is received and the next complete STOMP
frame can be parsed.

In Reactor Net 2.x this was handled for us through the "remainder"
field in NettyChannelHandlerBridge. The Reactor Netty 0.6 upgrade
however applied only a simple map operator on the input ByteBuf
after which the buffer is relased.

This commit replaces the use of a simple map operator for decoding
and installs a ByteToMessageDecoder in the Netty channel pipeline
which has a built-in ability to preserve and merge unread input into
subsequent input buffers.
2016-12-28 21:36:37 -05:00
Rossen Stoyanchev fdf88c9795 Workaround for onReadIdle issue in Reactor TcpClient
https://github.com/reactor/reactor-netty/issues/22
2016-12-28 21:36:37 -05:00
Rossen Stoyanchev 2a3e01399a Polish ReactorNettyTcpClient 2016-12-28 21:36:37 -05:00
Juergen Hoeller 5c48daa8eb Remove unused Log object from MessageHeaderAccessor
Issue: SPR-15045
2016-12-22 23:34:19 +01:00