Optimize type conversion in LambdaMessageProcessor

This commit is contained in:
Artem Bilan
2018-11-20 15:25:56 -05:00
committed by Gary Russell
parent ffaa4ee780
commit 20ed93a8d8

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2017 the original author or authors.
* Copyright 2016-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ import org.springframework.integration.support.utils.IntegrationUtils;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandlingException;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
/**
@@ -114,7 +115,9 @@ public class LambdaMessageProcessor implements MessageProcessor<Object>, BeanFac
}
}
else {
if (this.payloadType != null) {
if (this.payloadType != null &&
!ClassUtils.isAssignable(this.payloadType.getType(), message.getPayload().getClass())) {
if (Message.class.isAssignableFrom(this.payloadType.getType())) {
args[i] = message;
}