Announcement Announcement Module
Collapse
No announcement yet.
loading resource from user home directory Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • loading resource from user home directory

    Hi,

    I can easy load resource from classpath:

    Code:
    <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="location" value="classpath:parser/dictionary.properties"/>
    </bean>
    Is it possible to load it from other location described by environment variable, for example:

    Code:
    <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="location" value="$(user.home):parser/dictionary.properties"/>
    </bean>

  • #2
    Might want to look at PropertiesPlaceholderConfigurer. I'm not 100% sure if this is possible though, I remember reading about problems with the ordering of events with these things.

    http://www.springframework.org/docs/...lderconfigurer

    The PropertyPlaceholderConfigurer doesn't only look for properties in the Properties file you specify, but also checks against the Java System properties if it cannot find a property you are trying to use. This behavior
    can be customized by setting the systemPropertiesMode property of the configurer. It has three values, one to tell the configurer to always override, one to let it never override and one to let it override only if the property
    cannot be found in the properties file specified. Please consult the Javadoc for the PropertiesPlaceholderConfigurer for more information.

    Comment


    • #3
      see
      http://forum.springframework.org/sho...lderconfigurer

      Comment

      Working...
      X