Results 1 to 3 of 3

Thread: setting props for a properties file

Hybrid View

  1. #1
    Join Date
    May 2005
    Location
    San Jose, CA, US
    Posts
    59

    Question setting props for a properties file

    Hi,

    I was wondering if it is possible to set a variable list of properties on a bean, this list would come from an external properties file.

    What I was hoping to find was something like:
    <bean id="someBean" class="...">
    <property name="manyProps">
    <props file="external.properties"/>
    </property>
    </bean>

    Also, it would be nice if you could specify that the external properties file is at a relative location or on the class path.

    This not being possible, are there any other solutions to this problem?

    Thanks,
    Marius

  2. #2
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    Use a org.springframework.beans.factory.config.Propertie sFactoryBean. You set the location property with the name of the file.

  3. #3
    Join Date
    May 2005
    Location
    San Jose, CA, US
    Posts
    59

    Smile

    That worked, thanks!

    <bean id="someBean" class="...">
    <property name="manyProps">
    <bean class="org.springframework.beans.factory.config.Pr opertiesFactoryBean">
    <property name="location"><value>classpath:external.properti es</value></property>
    </bean>
    </property>
    </bean>

Posting Permissions

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