将Spring集成头值设置为bean属性
是否仍然可以将spring集成头的值设置为bean属性将Spring集成头值设置为bean属性,spring,spring-integration,Spring,Spring Integration,是否仍然可以将spring集成头的值设置为bean属性 <int:header-enricher> <int:header name="bId" expression="T(java.util.UUID).randomUUID()" /> </int:header-enricher> 我试过下面的方法,它们不起作用 <bean id="" class=""> <property name="bId" value="headers
<int:header-enricher>
<int:header name="bId" expression="T(java.util.UUID).randomUUID()" />
</int:header-enricher>
我试过下面的方法,它们不起作用
<bean id="" class="">
<property name="bId" value="headers['bId']" />
</bean>
<bean id="" class="">
<property name="bId" ref="headers['bId']" />
</bean>
Spring集成表达式,例如
<int:header name="bId" expression="T(java.util.UUID).randomUUID()" />
<property name="bId" value="#{...}" />
是初始化时间SpEL表达式-它们在上下文初始化期间进行计算。还没有消息
对象-求值的根对象是应用程序上下文,因此您可以在其他bean上引用属性
<property name="bId" value="#{somebean.foo}" />
这两种表达方式有很大的区别
<int:header name="bId" expression="T(java.util.UUID).randomUUID()" />
<property name="bId" value="#{...}" />
<property name="bId" value="#{somebean.foo}" />