Is there anyway to set value of spring integration header to bean property.
<int:header-enricher>
<int:header name="bId" expression="T(java.util.UUID).randomUUID()" />
</int:header-enricher>
Now in bean definition
<bean id="" class="">
<property name="bId" value="#{headers['bId']}" />
</bean>
This above code doesn't work. this throws exception
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'headers' cannot be found on object of type 'org.spri
ngframework.beans.factory.config.BeanExpressionContext' - maybe not public?
I tried below ways, they don't work
<bean id="" class="">
<property name="bId" value="headers['bId']" />
</bean>
<bean id="" class="">
<property name="bId" ref="headers['bId']" />
</bean>
Below would've been ideal, but this expression
is not available
<bean id="" class="">
<property name="bId" expression="headers['bId']" />
</bean>
Spring Integration expressions such as
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
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 beansThere's a big difference between these types of expressions.