Announcement Announcement Module
Collapse
No announcement yet.
How to override a property of list type Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to override a property of list type

    Hi all,

    I'm using a PropertyOverrideConfigurer to override some properties.
    Is it possible to override a property which is a collection, e.g. a list ? It seems like any string value will be considered as a single element.
    If this is not possible using simply a PropertyOverrideConfigurer, does anyone know of a workaround to achieve this ?

    Thanks in advance for your help.
    /Laurent

  • #2
    1. Extend the overrider and provide a custom implementation that creates a list.
    2. Create a property editor that for your class will translate a string (the list values comma-separated for example) into a list.

    Comment


    • #3
      To override java.util.Properties collection (as in the case of hibernate properties)

      org.springframework.beans.PropertyAccessor knows to parse properties using [] notation, so if you have:

      <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
      ...

      <property name="hibernateProperties">
      <value>
      hibernate.dialect=org.hibernate.dialect.MySQLDiale ct
      hibernate.show_sql=false
      hibernate.generate_statistics=false
      </value>
      </property>
      </bean>

      and hibernateProperties is of type java.util.Properties You can override it using:

      sessionFactory.hibernateProperties[hibernate.show_sql]=true

      Comment

      Working...
      X