Announcement Announcement Module
No announcement yet.
Complex types values in .properties file ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Complex types values in .properties file ?


    I read that applicationContext definitions can be in .properties file, and also PropertyPlaceholderConfigurer read property values from such file, but all examples that I've seen have plaing Strings as values. What about complex types ?

    For eg. how to set List property values. It seems that following doesn't work :

    mybean.somelistproperty = value1,value2,value3

    Is it possible at all ?


  • #2
    The PropertiesBeanDefinitionReader by default does not support lists or maps. Have a look at the constants defined in the class to see what pre- and suffixes you can use. It's not only limited to string values, you can also reference other beans and set a couple of properties of beans (singleton, lazy-init, etcetera).

    I suggest you have a look at the DefaultListableBeanFactoryTestSuite (package org.springframework.beans.factory), you can find more info about the syntax there.