Skip to content

Commit 20ed93a

Browse files
artembilangaryrussell
authored andcommitted
Optimize type conversion in LambdaMessageProcessor
1 parent ffaa4ee commit 20ed93a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spring-integration-core/src/main/java/org/springframework/integration/handler/LambdaMessageProcessor.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2017 the original author or authors.
2+
* Copyright 2016-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@
3535
import org.springframework.messaging.Message;
3636
import org.springframework.messaging.MessageHandlingException;
3737
import org.springframework.util.Assert;
38+
import org.springframework.util.ClassUtils;
3839
import org.springframework.util.ReflectionUtils;
3940

4041
/**
@@ -114,7 +115,9 @@ else if (Map.class.isAssignableFrom(parameterType)) {
114115
}
115116
}
116117
else {
117-
if (this.payloadType != null) {
118+
if (this.payloadType != null &&
119+
!ClassUtils.isAssignable(this.payloadType.getType(), message.getPayload().getClass())) {
120+
118121
if (Message.class.isAssignableFrom(this.payloadType.getType())) {
119122
args[i] = message;
120123
}

0 commit comments

Comments
 (0)