Announcement Announcement Module
No announcement yet.
Spring expression challenge with content enricher Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring expression challenge with content enricher

    Hi there,

    I am trying to use the content enricher to apply some instance-specific properties to my domain objects. One of the properties on my domain object is an XmlGregorianCalendar (let's call it instanceDate). What I'd ideally like to do is configure my instance-specific property in a properties file, and then apply it to my domain object using the enricher and a Spring expression.

    Properties file extract:
        <entry key="">2012-01-01</entry>
    Spring Integration file extract:
    <int:enricher id="instanceProperties">
        <int:property name="instanceDate" expression="SPRING EXPRESSION(${})" />
    Is this possible, and if so, what would the expression look like?

    I'm relatively new to Java, BTW, so apologies if this is all a naive question. If it were possible to call some kind of utility class, I guess that would probably solve it also.

    The desired chain seems to be
    (1) string-->DateFormat --or-- Date --or-- SimpleDateFormat
    (2) Datey Thing --> GregorianCalendar
    (3) GregorianCalendar --> XmlGregorianCalendar

    Best wishes,


  • #2
    It could be done, but the expression would be very ugly.

    A simply utility class that does the conversion would probably be easiest

    <bean id="toXMLGreg" class="foo.MyConverter">
        <constructor-arg value="${}" />
    <int:enricher id="instanceProperties">
        <int:property name="instanceDate" expression="@toXMLGreg.getInstanceDate()" />


    • #3
      Thanks Gary - that method worked for me. Best wishes, Ben