* GH-2872: Parse all the multi-part files
Fixes https://github.com/spring-projects/spring-integration/issues/2872
The same HTML form entry may have several files in the multi-part request.
Parse all of them in the `MultipartAwareFormHttpMessageConverter.java`
and re-map to the result `MultiValueMap`
**Cherry-pick to 5.1.x**
* * Add test for multi-part files
* GH-2873: Preserve mapping order in the router
Fixes https://github.com/spring-projects/spring-integration/issues/2873
Sometime it is important to map to most specific exception instead of
its super class.
* Use `LinkedHashMap` for mapping keys in the
`ErrorMessageExceptionTypeRouter`, as well as in its
`AbstractMappingMessageRouter` superclass.
Since we don't do that internal map modification, there is no reason to
worry about concurrent access: we just replace an internal instance
atomically with a new `LinkedHashMap` every time we modify a mapping
for router
**Cherry-pick to 5.1.x**
* * Fix `RouterSpec.RouterMappingProvider` to `LinkedHashMap` as well
* * Fix `RouterTests` for proper mapping order
* Polishing for `AbstractMappingMessageRouter` hierarchy, so we don't
use `protected channelMappings` field access any more
See https://github.com/spring-projects/spring-integration/pull/2837
Give priority to accepting new connections over reading data from
existing connections.
Add a flag to allow users to revert to the previous behavior of
giving reads priority.
**cherry-pick to 5.1.x**
* Short-circuit methods for lambdas from annotation
When we have a `@ServiceActivator` or any other messaging annotations
on `Function` or `Consumer` `@Bean`s, there is a restriction when we
can't use lambdas because of target method argument type erasure in Java.
* Use a `@Bean` method return to determine the target function argument
type and wrap the call into the `LambdaMessageProcessor`.
In this case we call the target method directly after possible payload
conversion according expected generic type for `Function` or `Consumer`.
There is just no reason to go a `MessagingMethodInvokerHelper` route
for this lambda variants
* Apply the short-circuit algorithm for Kotlin lambdas as well
* Make some refactoring and improvements to `ClassUtils`
if favor or similar API in the SF `ClassUtils`
* Fix `No beanFactory` warning for the `ExpressionCommandMessageProcessor`
* * Resolve Checkstyle violations
* * Fix `resolveAttributeToBoolean()` argument name to be generic
* Fix typo in the exception message for `IntegrationFlowDefinition.get()`
* * Revert `ClassUtils.resolvePrimitiveType()` logic: an existing in SF
does exactly opposite one
To avoid wrong encoding during reading and writing files by the
`updateCopyrights` Gradle task, it is better to have an explicit
`-Dfile.encoding=UTF-8` before starting JVM.
* Fix `AbstractFilePayloadTransformerTests` for non-standard symbols in
the test data
* fix broken test
`FileToStringTransformerTests.transform_withWrongEncoding_notMatching()`
* Do not fix urls for the `http://apache.org/xml/features` when we
configure XML components
* Do not fix urls for localhost and fake links in tests
* Fix all the dead links in docs
Fixes: https://github.com/spring-projects/spring-integration/issues/2820
The current `FtpRemoteFileTemplate.exists()` implementation obtains a
`Session` for the `NLST_AND_DIRS` mode, but doesn't close it.
* Fix the `FtpRemoteFileTemplate.exists()` method to delegate to `super`
for the proper interaction with a `Session`
**Cherry-pick to 5.1.x, 5.0.x & 4.3.x**
* Support generics in the `JsonToObjectTransformer`
* Deprecate `JsonObjectMapperAdapter` if favor of `default` methods in
the `JsonObjectMapper`
* Introduce `JsonObjectMapper.fromJson(Object, ResolvableType)` to
support generics during deserialization
* Add `JsonHeaders.RESOLVABLE_TYPE` header handling for the
`ResolvableType` management
* Add `ResolvableType` argument into the `JsonToObjectTransformer`
* Change the `JsonToObjectTransformer` logic to consult request message
headers first
* Add `ResolvableType`-based factory method into the `Transformers`
* Document the change
* * Use `0` for conversion to array for headers to remove
in the `JsonToObjectTransformer`
* Fix synchronization smell in the `MessagePublishingInterceptor`
* Cache `Pointcut` in the `PublisherAnnotationAdvisor`;
fix `@SuppressWarnings` also
* Fix complexity in the `IntegrationMBeanExporter`
After `MessagingAnnotationPostProcessor` fix for the late endpoints
registration we end up with the fact that `IntegrationMBeanExporter`
tries to register an `MBean` for the `MessageHandler/MessageSource`
one more time after parsing an `AbstractEndpoint`.
We don't fail because we catch an exception for already registered MBean
and just log it with ERROR
* Fix `IntegrationMBeanExporter` to check for
`MessageHandler/MessageSource` presence in the registered `objectNames`
* Some refactoring in the `IntegrationMBeanExporter` and fixes for
Sonar smells
* INT-2277: Register ChResolver & ErrHandler beans
JIRA: https://jira.spring.io/browse/INT-2277
To avoid extra objects at runtime and reuse a central configuration,
register `BeanFactoryChannelResolver` and `MessagePublishingErrorHandler`
bean via `DefaultConfiguringBeanFactoryPostProcessor`
* Use those beans whenever it is necessary via `IntegrationContextUtils`
factory methods against provided `BeanFactory`
* To avoid changes in the non-managed test, those new factories fall
back to a new instance if there is no an appropriate bean in the `beanFactory`
* * Add `Assert.notNull(beanFactory)` to new factory methods
* GH-2690: Add MessageHandlerMethodFactory beans
Fixes https://github.com/spring-projects/spring-integration/issues/2690
For more end-user flexibility and for simplicity of the `MessagingMethodInvokerHelper`
logic, add `IntegrationContextUtils.MESSAGE_HANDLER_FACTORY_BEAN_NAME` and
`IntegrationContextUtils.LIST_MESSAGE_HANDLER_FACTORY_BEAN_NAME`
infrastructure beans
* Use mentioned beans in the `MessagingMethodInvokerHelper` if any,
otherwise fallback to the locally configured `MessageHandlerMethodFactory`,
although this is necessary only for our non-Spring-based unit tests
* Relax `BeanFactory` requirement for the `EvaluationContext` since it
is going to be there in the Spring-based environment, but might not be
available in the plain unit tests
* Provide some optimization and refactoring for the `MessagingMethodInvokerHelper`
* Remove deprecated `HandlerMethodArgumentResolversHolder` and
`ARGUMENT_RESOLVERS_BEAN_NAME` & `LIST_ARGUMENT_RESOLVERS_BEAN_NAME`
bean definitions and constants for their names
* * Revert `getEvaluationContext(false)` usage.
* Fix `MessagingMethodInvokerHelper` to propagate `BeanFactory` to
argument resolvers if any
Fixes https://github.com/spring-projects/spring-integration/issues/2799
**Cherry-pick to 5.1.x & 5.0.x**
When `AnnotationGatewayProxyFactoryBean` is used for the one-way (`void`)
POJI method invocation and downstream processing is based on an
`ExecutorChannel`, the default `errorChannel` value from the annotation
is resolved to the empty string with is set to the target gateway proxy
and can not be resolved to the target bean eventually in the
`MessagePublishingErrorHandler` in case of exception
* Check `errorChannel` attribute for empty string and don't set it into
the `errorChannelName`.
This way the `MessagePublishingErrorHandler` will resolve to the global
`errorChannel` as expected.
* Fix new Sonar smells for MMIH
* Fix complexity smells in the `MessagingMethodInvokerHelper`
* Reuse `get()` in the `ZookeeperMetadataStore` in case of `putIfAbsent()` error
* Polishing for `ZookeeperMetadataStoreTests`
* Fix for `hasUnqualifiedMapParameter`
* Fix `findHandlerMethodsForTarget()` complexity
* * Fix typo and remove FQCN for `ClassUtils`
Prior to this commit, `RedisAvailableRule.apply()` threw an
`AssumptionViolatedException` when Redis was unavailable. That caused
the execution of the current test class and all pending test methods to
be stopped immediately. Instead, it now returns a `Statement` that
throws the exception in case Redis is unavailable which will only skip
the current test.
Resolves#2782.
Fixes https://github.com/spring-projects/spring-integration/issues/2753
* Remove Guava dependency and its minor functionality from the
`StoredProcExecutor`
* Remove `@ManagedResource` and its operations/attributes from
`StoredProcExecutor` since they are not relevant any more
* Remove tests related to JMX and Guava
* Refactor all other tests in the affected classes
* Some code polishing in the `StoredProcExecutor`
* Fix MMIHelper for reinitialization
If we provide a custom `MessageHandlerMethodFactory`, the
`MessagingMethodInvokerHelper` obtains its bean and reinitialize a
`handlerMethod`, but it is done only for single, explicit
and provided method.
In case of `Function` or `Consumer` we use local names for methods to
extract, but this is not populated to properties of the
`MessagingMethodInvokerHelper`
* Change an internal `MessagingMethodInvokerHelper` logic to recreate
`InvocableHandlerMethod` instances based on the `MessageHandlerMethodFactory`
bean for all the methods scanned on the target.
* Populate a `handlerMethodsList` for the purpose above even if we have
only one candidate
* Fix `AggregatorParserTests` to reflect the current logic around
`handlerMethodsList`
* Prove that new logic works well with a custom `MessageHandlerMethodFactory`
bean in the `MessagingAnnotationsWithBeanAnnotationTests`
**Cherry-pick to 5.1.x**
* * Move CTOR to the proper place
* INT-3459: Log exceptions in case of failOver
JIRA: https://jira.spring.io/browse/INT-3459
When `UnicastingDispatcher` is configured with `failOver` (true by default),
it loses exceptions it caught with previous handler when the next one
processes message properly
* Add INFO logging for exceptions which are caught before going to fail
over to the next handler
* * Address PR comments
* * More PR comments
* Add a note about this logging into the `channel.adoc`
* Add `RateLimiterRequestHandlerAdvice.getRateLimiter()` to get access
to the configured `RateLimiter` for possible low-level operations and
management
* Fix the `RateLimiterRequestHandlerAdviceTests` to calculate the sleep
based on the `reservePermission()` plus `REFRESH_PERIOD`
Resolves https://github.com/spring-projects/spring-integration/issues/2777
If the filter supports it, defer filtering until the last possible moment.
Then, the worst case scenario after a catastrophic failure (e.g. power loss),
would be that at most one file will be incorrectly filtered on restart.
Polishing and add more tests.
Polishing Javadocs
More Polishing
Final polishing
More polishing.
Polishing and docPolishing and docs.
* Fix typos in Docs