有没有办法在Spring header-enricher
的expression
字段的三元表达式中使用弹簧属性?看起来像这样的东西:Spring集成有条件的SpEL使用属性
<int:header-enricher>
<int:header name="DESTINATION" expression="headers['DATA'].routingKey == 'ROUTE1' ? ${route1.db} : ${route2.db}"/>
</int:header-enricher>
这导致错误说Unexpected token. Expected 'colon(:)' but was 'lcurly({)'
。也许我错过了什么。
谢谢@哈森!第一个建议帮助我意识到属性'route1.db'不存在。虽然这只是修复的一部分,但我会接受这个答案。 –