Announcement Announcement Module
Collapse
No announcement yet.
setting props for a properties file Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Use a org.springframework.beans.factory.config.Propertie sFactoryBean. You set the location property with the name of the file.

    Comment


    • #3
      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>

      Comment

      Working...
      X