Commit Graph

284 Commits

Author SHA1 Message Date
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
Sebastien Deleuze 1f28825f9d Add more @Nullable parameters based on null usage
Issue: SPR-15540
2017-05-31 21:42:23 +02:00
Sebastien Deleuze b47d713e14 Add missing @Nullable annotations on parameters
Issue: SPR-15540
2017-05-31 16:56:08 +02: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
Stephane Nicoll 929ab10b49 Polish 2017-04-18 13:33:27 +02:00
Stephane Nicoll 4ffdb50681 Reuse QosSettings in JmsTemplate
See SPR-15408
2017-04-18 13:32:53 +02:00
Stephane Nicoll a2acbee004 Polish 2017-04-18 13:18:08 +02:00
Stephane Nicoll 1c0b3be6e6 Customize QosSettings for JMS replies
This commit introduces QosSettings that gather the Qualify of Service
settings one can use when sending a message. Such object can now be
associated to any JMS endpoint that allows to send a reply as part of
the processing of an incoming message.

Issue: SPR-15408
2017-04-18 13:15:38 +02:00
Juergen Hoeller 29f2c96a3d Drop unnecessary modifiers for constants in JmsHeaders interface 2017-04-14 22:45:03 +02:00
Juergen Hoeller e9019cd7d1 Polishing 2017-02-10 10:56:40 +01:00
Juergen Hoeller acf511ac0e Polishing 2017-02-02 20:11:06 +01:00
Stephane Nicoll d550eb152c Polish contribution
Closes gh-1307
2017-01-27 14:17:13 +01:00
Ruben Dijkstra f1c7e0f5b2 Check for null on the argument instead of the message
See gh-1307
Issue: SPR-15196
2017-01-27 14:15:24 +01:00
Juergen Hoeller a9ae2c3402 Polishing 2017-01-23 12:42:01 +01:00
Juergen Hoeller e566e25b6f Clear nonAnnotatedClasses cache in afterSingletonsInstantiated
Issue: SPR-15175
2017-01-23 12:29:38 +01:00
Juergen Hoeller fc629bb508 Polishing 2016-12-29 22:39:36 +01:00
Juergen Hoeller edc62be231 @Scheduled reliably applies after other post-processors and shuts down before TaskScheduler
Issue: SPR-14692
Issue: SPR-15067
2016-12-29 22:35:10 +01:00
Juergen Hoeller 2819f7c781 Polishing 2016-12-22 22:36:07 +01:00
Juergen Hoeller ac774cdcef Avoid deprecated Mockito methods
Issue: SPR-14880
2016-11-04 12:24:46 +01:00
Juergen Hoeller ac80ac6f8b Consistent instanceof/casting of Class references 2016-10-30 21:40:27 +01:00
Philippe Marschall ae5b0c6fb5 Replace J2EE with Java EE
String with version 5 the name of Java Platform, Enterprise Edition
changed from J2EE to Java EE. However a lot of the documentation still
uses the term J2EE.

This commit includes the following changes:

 * replace J2EE with Java EE where appropriate

This is not a blind search and replace. The following occurrences
remain unchanged:

 * references to old J2EE releases, most notably 1.3 and 1.4.
 * references to "Expert One-On-One J2EE Design and Development"
 * references to "Core J2EE patterns"
 * XML namespaces
 * package names

Issue: SPR-14811
See gh-1206
2016-10-15 11:49:00 +03:00
Juergen Hoeller edbc1e9212 Avoid outdated Tibco workaround in shouldCommitAfterNoMessageReceived
Issue: SPR-14697
2016-09-13 21:34:47 +02:00
Juergen Hoeller 8c5660683a MappingJackson2MessageConverter adds message id and destination to type resolution exception
Issue: SPR-14672
2016-09-10 12:37:55 +02:00
Juergen Hoeller 59a24b406a Polishing 2016-08-10 14:20:42 +02:00
Juergen Hoeller b9ab895743 Inferred generics for newSetFromMap arrangements
Issue: SPR-13188
2016-07-26 21:26:31 +02:00
Juergen Hoeller e03dea1d64 Polishing 2016-07-26 17:15:19 +02:00
Juergen Hoeller d07381e862 Avoid deprecated number constructors on JDK 9
Issue: SPR-13344
2016-07-19 19:25:55 +02:00
Juergen Hoeller c43e7497c1 Fixed typo: "occured"->"occurred" 2016-07-08 15:12:16 +02:00
Stephane Nicoll e4b0486c5a Add @FunctionalInterface on candidate interfaces
Issue: SPR-14432
2016-07-06 14:32:13 +02:00
Juergen Hoeller 355c6f0715 Upgrade to JMS 2.0 and JCA 1.7
Issue: SPR-13793
2016-07-05 22:18:19 +02:00
Juergen Hoeller bc2c22d51e Streamline XML namespace support towards unversioned schemas
This commit also removes support code for outdated options which were only available in older schema versions.

Issue: SPR-13499
2016-07-05 20:50:03 +02:00
Sam Brannen 1391248ea6 Introduce log4j 2 for Spring's test suite
This commit adds a test runtime dependency on log4j 2 for every project
and migrates all log4j.properties files to log4j2-test.xml files.

Issue: SPR-14431
2016-07-05 19:19:09 +02:00
Stephane Nicoll 00d2606b00 Explicit type can be replaced by <>
Issue: SPR-13188
2016-07-05 17:00:34 +02:00
Juergen Hoeller b5db5d3aac Broadly remove deprecated core classes and methods
Issue: SPR-14430
2016-07-05 15:52:49 +02:00
Stephane Nicoll eba873067c Better hide lazy resolution of JMS payloads
This commit fixes MessagingMessageConverter to no longer expose the lazy
message resolution algorithm. This restores proper behaviour for
converters used outside of that context.

Instead, such arrangement is now private to
AbstractAdaptableMessageListener (as it should).

Issue: SPR-14389
2016-06-29 18:10:34 +02:00
Stephane Nicoll 9c02a99d38 Polish doc
SPR-14290
2016-05-20 09:57:41 +02:00
Juergen Hoeller 8c139ef444 Polishing 2016-05-04 17:37:30 +02:00
Juergen Hoeller 07ea3745c4 Polishing 2016-05-02 13:54:47 +02:00
Stephane Nicoll 09b45d2c0f Validate callback is always invoked in DMLC#stop
The underlying issue has been fixed in e45d33f and this commit is merely
adding a test of the expected behaviour.

Issue: SPR-14233
2016-05-02 13:33:05 +02:00
Juergen Hoeller f83cbff543 Consistent SmartLifecycle implementations
Issue: SPR-14233
2016-05-02 13:01:44 +02:00
Juergen Hoeller e45d33f9de DefaultMessageListenerContainer immediately invokes stop callback when not running
Issue: SPR-14233
2016-05-02 12:57:30 +02:00
Juergen Hoeller 6ab8d36ed0 DefaultMessageListenerContainer's recovery phase uses wait instead of sleep
Issue: SPR-14200
2016-04-27 21:27:21 +02:00
Juergen Hoeller 87b93a7ae9 Aligned JmsTemplate and DefaultMessageListenerContainer receiveTimeout values
Issue: SPR-14212
2016-04-26 17:09:57 +02:00
Johnny Lim 44e652f99e Remove duplicate words
Closes gh-1039
2016-04-19 08:24:21 +02:00
Juergen Hoeller 537193a4e0 Consistent license header 2016-04-11 20:49:38 +02:00
Juergen Hoeller 26378cd604 Polishing 2016-04-04 20:51:30 +02:00
Stephane Nicoll 996c1cc0a6 Fix Auto-Startup for @JmsListener
Ignore container's auto-startup once the context is refreshed.

Issue: SPR-14015
2016-04-04 18:21:10 +02:00
Sam Brannen 2ed3382a60 Document composed support for @Scheduled, @JmsListener, & @Sql
Issue: SPR-13973
2016-03-29 19:53:58 +02:00
Juergen Hoeller 54aeb7a5d6 Cache key classes implement Comparable and consistently provide a toString representation
Issue: SPR-14017
2016-03-26 14:32:10 +01:00
Sam Brannen 4742aa0bfe Test @JmsListener as a merged composed annotation
Issue: SPR-13973
2016-03-26 01:09:35 +01:00
Sam Brannen 2353f39ee4 Clean up warnings 2016-03-26 01:08:58 +01:00
Juergen Hoeller c6ff0951fc Polishing 2016-03-25 23:46:18 +01:00
Sam Brannen d572b022cc Support @JmsListener as a merged composed annotation
Issue: SPR-13973
2016-03-25 00:51:24 +01:00
Juergen Hoeller 517ebd1d3e Consistent formatting 2016-03-24 19:22:50 +01:00
Juergen Hoeller 5025c615b1 Consistent use of AnnotatedElementUtils.findMergedAnnotation/hasAnnotation
Issue: SPR-13440
2016-03-23 18:39:20 +01:00
Rossen Stoyanchev f33578ef0f Fix failing test and warings
The test failure was caused by the previous commit. The Message
resolver now supports payload conversion so it can raise a
MessageConversionException, not MethodArgumentTypeMismatchException.
2016-02-18 22:37:57 -05:00
Juergen Hoeller ea4a766df7 Consistent support for SpEL next to placeholders in annotation attributes
Issue: SPR-13625
2016-02-17 23:00:07 +01:00
Juergen Hoeller 1253b451f5 DefaultMessageListenerContainer stops if recovery failed after interrupt signal
Issue: SPR-11787
2016-02-16 22:28:10 +01:00
Juergen Hoeller e90310612f Polishing 2016-02-04 20:00:00 +01:00
Stephane Nicoll a112557dc4 Support SendTo at class-level
Issue: SPR-13578
2016-01-16 16:34:02 +01:00
Stephane Nicoll dc8de51408 Json view support for JMS
Support of @JsonView on @JmsListener annotated method that uses the
jackson converter. Also update MappingJackson2MessageConverter to offer
a public API to set the JSON view to use to serialize a payload.

Issue: SPR-13237
2016-01-15 17:18:14 +01:00
Stephane Nicoll 31a3607de6 Lazy resolution of the JMS message
Previously, any `javax.jms.Message` was converted eagerly to the Message
abstraction. This leads to unnecessary conversion if the Payload is not
requested by the underlying method (i.e. if the `javax.jms.Message` is
injected directly).

This commit returns a `Message` implementation that holds the
`javax.jms.Message` and lazily resolve the payload or the headers on
demand (that is the first time they are requested).

Issue: SPR-13777
2016-01-14 17:20:25 +01:00
Juergen Hoeller 470ea977e1 Consistent validation of annotated methods behind AOP proxies
Issue: SPR-13816
2015-12-23 20:47:28 +01:00
Sam Brannen 5b3edcd9f9 Spring Cleaning in December
- Delete unused imports
- Delete unused code
- Clean up warnings
2015-12-17 20:27:33 +01:00
Juergen Hoeller 8ce5e88c66 Require Jackson 2.6+, FreeMarker 2.3.21+, XStream 1.4.5+
Issue: SPR-13062
2015-12-17 17:14:50 +01:00
Stephane Nicoll 752d3c715a Initiate structure for 4.3 XSDs 2015-12-17 15:43:23 +01:00
Juergen Hoeller 11806b9215 Class identity comparisons wherever possible (and further polishing)
Issue: SPR-12926
2015-12-09 12:28:09 +01:00
Juergen Hoeller 8346eeda27 Reset BytesMessage after payload extraction
Issue: SPR-13769
2015-12-08 17:12:38 +01:00
Juergen Hoeller 9589749fb2 Introduced createMethodJmsListenerEndpoint template method
Issue: SPR-13774
2015-12-08 17:07:40 +01:00
Johnny Lim 2defb6555e Fix broken Javadoc related to `<` and `>` 2015-11-12 11:22:08 +01:00
Juergen Hoeller 760bc719f2 Polishing 2015-11-09 15:03:14 +01:00
Juergen Hoeller da9c80c604 Revised method selection for JMS listeners (and their parameters)
Issue: SPR-13576
2015-11-09 15:02:15 +01:00
Stephane Nicoll 77af692e5e Polishing
Issue: SPR-13633
2015-11-02 20:35:41 +01:00
Stephane Nicoll 1bc41bdf0f Expose JMS message listener container ids
Issue: SPR-13633
2015-11-02 16:13:47 +01:00
Juergen Hoeller af213a09ee Polishing 2015-10-07 13:25:41 +02:00
Sam Brannen d5ee787e1e Migrate JUnit 3 tests to JUnit 4
This commit migrates all remaining tests from JUnit 3 to JUnit 4, with
the exception of Spring's legacy JUnit 3.8 based testing framework that
is still in use in the spring-orm module.

Issue: SPR-13514
2015-09-27 21:17:51 +02:00
Juergen Hoeller 1ed1167153 Avoid ConcurrentModificationException in SingleConnectionFactory's AggregatedExceptionListener
Issue: SPR-13421
2015-09-02 16:55:09 +02:00
Juergen Hoeller 965fca808a Polishing 2015-07-29 01:08:16 +02:00
Juergen Hoeller faab220946 Initial test for Jackson-based JMS reply
Issue: SPR-13237
2015-07-29 01:06:38 +02:00
Juergen Hoeller 14f27bda37 Prefer use of "Java EE" over "J2EE" 2015-07-27 15:32:56 +02:00
Juergen Hoeller e5a2b34829 Clarify acknowledge mode semantics and transaction recommendations
Issue: SPR-13278
2015-07-27 15:32:18 +02:00
Juergen Hoeller edd6e76b9f Polishing 2015-07-21 22:58:34 +02:00
Juergen Hoeller 203f1225c3 Polishing 2015-07-17 15:25:43 +02:00
Stephane Nicoll 4631add6cf Add support for repeatable JmsListener
Previously, a method could only declare one Jms endpoint so if several
destinations share the exact same business logic, you'd still need one
separate method declaration per destination.

We now make sure that JmsListener is a repeatable annotation, introducing
JmsListeners for pre Java8 use cases.

Issue: SPR-13147
2015-06-22 13:01:42 +02:00
Stephane Nicoll c8fcdadbae Polish
Review bd093eb to provide a generic type on `JmsResponse`

Issue: SPR-13133
2015-06-16 15:33:50 +02:00
Stephane Nicoll bd093eb6bf Runtime resolution of JMS reply destination
Add JmsResponse that can be used as return type of any JMS listener
method to indicate not only the response but also the actual destination
to which the reply should be sent.

Issue: SPR-13133
2015-06-16 15:02:22 +02:00
Juergen Hoeller ad55687627 Polishing 2015-06-11 12:33:30 +02:00
Sam Brannen 60a5ec87d0 Introduce alias for 'value' attribute in @Header
This commit introduces 'name' as an alias for 'value' in @Header.

Issue: SPR-11393
2015-05-29 23:23:52 +02:00
Juergen Hoeller 05d475a275 Polishing 2015-05-22 23:50:47 +02:00
Juergen Hoeller fee63fdfb8 Message listener containers only call Session.recover() in client acknowledge mode
Issue: SPR-13056
2015-05-22 12:16:59 +02:00
Juergen Hoeller b4095c3e1d Class identity comparisons wherever possible
Issue: SPR-12926
2015-05-20 14:34:16 +02:00
Juergen Hoeller 72894b26c2 Fix conversion of Message<?> payload for replies
If a custom MessageConverter is set, it is not used for replies defined
via the Message abstraction. This commit harmonizes the behaviour of the
`MessagingMessageConverter` so that the conversion of the payload can
be converted for both incoming and outgoing messages.

Issue: SPR-12912
2015-04-20 13:29:32 +02:00
Stephane Nicoll 444b9032be Apply DestinationResolver to listener container
Previously, a custom `DestinationResolver` was not made available
to the underlying `MessageListener`: if a reply needs to be sent, the
default `DestinationResolver` was used.

This commit ensures that if a custom `DestinationResolver` has been set,
it is also configured accordingly for replies.

Issue: SPR-12927
2015-04-20 09:51:33 +02:00
Juergen Hoeller d398bb7c51 DefaultMessageListenerContainer uses receiveTimeout for wait call on shutdown
Issue: SPR-11841
2015-04-16 22:49:45 +02:00
Stephane Nicoll f98a6c6b6a Support expression in @SendTo
The attributes of @JmsListener allows to specify the reference to a key
in the Environment but @SendTo did not.

This commit fixes this inconsistency so that response destinations are
now also externally configurable.

Issue: SPR-12899
2015-04-16 18:18:29 +02:00
Stephane Nicoll 2c7d2d38a9 Support custom resolution of response destination
Previously, the "pubSubDomain" drove the resolution of both the
destination of the listener and the default response destination.

A new "replyPubSubDomain" attribute has been added on the base listener
and  can be used to listen on a topic and reply to a queue (or vice
versa). The attribute is exposed via the "response-destination-type" XML
attribute on the listener container element. It is also available on the
JmsListenerContainerFactory for use with the @JmsListener infrastructure.

Issue: SPR-12911
2015-04-16 17:29:48 +02:00
Stephane Nicoll 6f3570a0f6 Add auto-startup support for JmsListenerContainerFactory
The auto startup flag can now be set on a JmsListenerContainerFactory to
control if the created container should be started automatically when the
application context starts.

Issue: SPR-12824
2015-04-07 11:32:57 +02:00
Juergen Hoeller 6f98cf3add Explicit documentation on 4.1+ properties in AbstractMessageListenerContainer 2015-03-17 21:41:37 +01:00
Juergen Hoeller b541fc9366 Polishing 2015-03-05 18:56:57 +01:00
Stephane Nicoll 31df7155ab Refine BeanPostProcessorChecker condition
Previously, adding `@EnableAsync` on a blank application would lead to an
info message stating that `ProxyAsyncConfiguration` is not eligible for
getting processed by all BeanPostProcessors. Concretely, this is ok as
such internal configuration is not meant to be a target of such post
processing.

Revisit the condition for non infrastructure bean only. Add the
infrastructure role to a set of internal configuration, including the
`ProxyAsyncConfiguration`.

Issue: SPR-12761
2015-03-05 11:37:11 +01:00