This should be a simple question, but I cannot find the proper doc online. I want to do this:
@MessagingGateway(name = "redemptionGateway", defaultRequestChannel = Channels.GATEWAY_OUTPUT, defaultHeaders = @GatewayHeader(name = "orderId", expression = "#redemption.orderId"))
public interface RedemptionGateway {
void create(TrivialRedemption redemption);
}
I am obviously using the wrong statement to reference the orderId member of redemption:
org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Property or field 'orderId' cannot be found on null
OK. Look
This SpEL is evaluated at runtime against actual arguments to build
MessageHeadersfor targetMessageto send.And that is how it looks:
So,
EvaluationContextis enriched with two variablesargsandgatewayMethod.As you see, there is no any arguments population by their name. Will that work anyway for all the JVMs?
You can achieve your goal using parameter index from the
args: