Gabriel Bauman
Gabriel Bauman

Reputation: 2416

Header annotation with "." in header name, such as @Header("foo.bar"), doesn't map

I have a simple Spring Integration message endpoint with the signature:

@Transformer
String handleMessage(@Payload String payload, @Header("nerf") String nerf, @Header("foo.bar") String foobar) {
 //...
} 

The variable nerf always contains the header value it received from Kafka. The variable foobar is always null, despite the header named foo.bar existing in the inbound message.

This is a simple DSL-based flow coming straight off the Kafka binder.

It seems that any parameter with a name that contains the . character doesn't get mapped properly.

What am I doing wrong? Is the @Header(name) a SpEL expression?

Upvotes: 0

Views: 121

Answers (1)

Gary Russell
Gary Russell

Reputation: 174584

It's designed that way; so you can extract property bar from a header named foo.

However, quoting it as Oleg suggested should work, but does not; we end up looking for header ''foo' with property bar'.

I have opened a GitHub issue.

Upvotes: 1

Related Questions