I ran into this for property substitution in spring
but u
several approaches:
in src/main/resources/your-conf.xml
in src/test/resources/your-test-config.xml
If you running your test with src/test/resources
as a test classpath, the above will ensure to override src/main/resources/esb-project-config.properties
with the src/test/resources/esb-project-config.properties
.
This will override the whole property-placeholder
though, so you would have to provide all the properties needed in your application in for this test property-placeholder
. e.g.
to override certain individual properties. Some examples here
You can use a prefix to control environment specific properties, this can be done by using system variables:
In this case it will always look under:
by default, unless a ENV_SYSTEM
system variable is set. If it is set to qa
, for example, it will automatically look under:
Another approach is to make beans profile specific. For example:
The appropriate esb-project-config
will loaded depending on a profile set. For example this will load esb-project-config.dev.properties
:
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
ctx.getEnvironment().setActiveProfiles( "dev" );
ctx.load( "classpath:/org/boom/bang/config/xml/*-config.xml" );
ctx.refresh();