Results 1 to 2 of 2

Thread: Populating List values from a file

  1. #1
    Join Date
    Jun 2007
    Posts
    1

    Default Populating List values from a file

    I'm trying to populate List fields from values stored in text files. I've seen reference on how to load properties (key=value), but not a straight (value) file.

    I'm looking at the ListFactoryBean and Resource subclasses, but I'm still not sure where I'm missing the boat. I see the PropertyPlaceholder class, but I dont know if that's what I need to be using.

    So, in short, how do I populate myList with the contents of MyFile?


    thanks in advance!

    class Foo
    {
    List myList; // assumed to be a list of String
    ....
    getXXX/setXXX
    }

    <bean id="foo" class="Foo">
    <property name="myList" value=???/>
    </bean>

    MyFile.txt:
    A Value
    Another Value

  2. #2
    Join Date
    Mar 2007
    Posts
    515

    Default

    Haven't tried this approach, but I think you can do this with PropertyEditors.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •