spring-integrationspelevaluationexception

Gateway interface breaking after upgrading from SI v 2.2 to v 3.0.5


After upgrading SI from v 2.2 to v 3.0.5 I'm getting an error for the following gateway. Has the behaviour of gateway interfaces changed in v 3.x to not accept Message types?? Any hints would be appreciated as to why this is happening.

org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 8): Method call: Method sendStat(my.domain.ReplyStatEvent) cannot be found on com.sun.proxy.$Proxy22 type]

void sendStat(@Payload Message<? extends LiveStatEvent> message);

ReplyStatEvent extends LiveStatEvent and the gateway is invoked using a service activator definition like this:

<int:service-activator ref="liveStatsGateway" method="sendStat" />

It works fine after changing the interface to the following.

void sendStat(@Payload LiveStatEvent message);

Solution

  • Even if it had worked before, it doesn't mean that it was correct syntax.

    If your gateway's param is marked with @Payload, it is assumed that Framework will inject to that arg a payload of the Message, but not entire Message.

    We just fixed that ambiguity and show you now that your use-case isn't correct.

    So, if you want to use just payload, you'll be able to specigy just payload type for param. The @Payload isn't necessary is this case. It is required, if your method has several args and Framewrok can't determine which one for payload.

    If you want get deal with whole Message, there is just enough to have an arg of that type.

    Anyway a combination @Payload Message<?> isn't correct. Hence you just need to fix those Migration Guide cases.