Set Spring Integration header value to bean property

前提是你 提交于 2019-12-06 08:18:43

Spring Integration expressions such as

<int:header name="bId" expression="T(java.util.UUID).randomUUID()" />

are runtime expressions - they apply to messages flowing through the system; in most cases the root object for the expression evaluation is the Message.

Expressions such as

<property name="bId" value="#{...}" />

are initialization time SpEL expressions - they are evaluated during context initialization. There is no Message object yet - the root object for the evaluation is the application context, so you can do things like referencing properties on other beans

 <property name="bId" value="#{somebean.foo}" />

There's a big difference between these types of expressions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!