Announcement Announcement Module
Collapse
No announcement yet.
property-placeholder with location from system property Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • property-placeholder with location from system property

    Hi

    I need to load some properties into a Spring context from a location that I don't know until the program runs.

    I have tried

    Code:
    <context:property-placeholder location="${my.location}"/>
    and set my.location as a system property but this doesn't work.

    Paul

  • #2
    Im not sure whether your app is a web-app or not.

    if its web-app try these steps

    1. define a context-param with key = webAppRootKey and value = my.location [the var name that you want to refer later] in your web.xml

    2. define a listener WebAppRootListener in your web.xml. this should appear before the ContextLoaderListener declaration in your web.xml

    define a bean definition in your xml
    Code:
    <bean id="systemProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
    PS: im not sure of the class-name .. sure it ends wtih
    Last edited by write2karthikr; Aug 21st, 2009, 07:23 AM. Reason: typo :)

    Comment

    Working...
    X