I want to specify only the properties that I want to override in the test properties file with the same name in the src / test / resources folder.
A bit more ...
In the maven layout, I have a properties file that contains the expanded value to use (e.g. input.uri).
src/main/resources/app.properties: input.uri=jms:topic:in app.name=foo_bar
The properties of this file are loaded into the context.xml file using the placeholder property:
src/main/resources/META-INF/spring/context.xml: <context:property-placeholder properties-ref="springProperties"/> <util:properties id="springProperties" local-override="true" location="classpath:app.properties" />
I have a test properties file with the same name, app.properties , in the src / test / resources folder and override the definition of input.uri with what my junit test will use. (note that the application name does not change).
src/test/resources/app.properties: input.uri=seda:in
How could you write a junit test and / or a context.xml test file so that the properties are loaded from the src / main / resources / app.properties file , but any properties defined in the src / test / resources / app.properties file will override the files in src / main / resources / app.properties file . Without obviousness, you are loading two different files either into src / main files or into src / test junit test files - I want the property placeholder to look for the class path and select the correct values.
source share