Results 1 to 2 of 2

Thread: Dynamic Property File Loading in Spring based on the URL Argument.

  1. #1
    Join Date
    Apr 2012
    Posts
    7

    Default Dynamic Property File Loading in Spring based on the URL Argument.

    Hi, I am working in a environment which needs to load/change the property files based on the URL argument. But the problem is based on the configuration all the property files are loading before getting the URL argument.

    Consider that My root-context.xml file contains the configuration like following...

    Code:
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    	<property name="ignoreResourceNotFound" value="true"></property>
    	<property name="locations">
    	<list>
    	 <value>classpath:app.properties</value> 
    	</list>
    	</property>
    	</bean>
    I am loading the property files from the classpath by default...
    After complete build of application and I will deploy the application in server and runs it. When I am sending the request I will send some argument as "c=um" as part of url. So I need to get this argument and change the property file based on this argument or load the property files.

    The Questions are: Can I change the name of the property file in configuration

    Code:
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    	<property name="ignoreResourceNotFound" value="true"></property>
    	<property name="locations">
    	<list>
    	 <value>classpath:um.properties</value> 
    		
    	</list>
    	</property>
    	</bean>
    After changing the name can I reload the property files with out restarting the application.

  2. #2
    Join Date
    Sep 2008
    Location
    Hamburg, Germany
    Posts
    1,637

    Default

    Hey!

    I moved this question over to the web forum since it looks more like a general Spring and web question than an IDE issue.

    -Martin
    Martin Lippert
    SpringSource, a division of VMware
    SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/martinlippert

Tags for this Thread

Posting Permissions

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