Announcement Announcement Module
Collapse
No announcement yet.
Configuration selection through properties Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configuration selection through properties

    Hi

    I have two configuration files I want to select from when wiring up my tests, eg for live DAOs and Mock DAOs. Ideally I want to write one test and pass in a parameter to switch between live or mock. Is there a way to do this?

    I managed to pass in a system property, but can't get it to work with the value from a properties file.

    Code:
    <util:properties id="testConfig"
    		location="classpath:META-INF/spring/test.properties">
    		<prop key="mode">live</prop>
    	</util:properties>
    
    	<context:property-override
    		properties-ref="testConfig"  
    		location="classpath*:META-INF/spring/test.properties" />
    
    
    	<import resource="classpath:META-INF/spring/${mode}-beans.xml" />
    test.properties

    Code:
    mode=mock
    The mode is having an effect when passed into the VM using -Dmode, but not from the properties file.
Working...
X