java - Run my integration tests with a different *.properties file using Spring 4.0.6.RELEASE -
i using spring 4.0.6.release , have following spring configuration file:
@configuration @propertysource({"classpath:config.properties"}) public class myserviceconfig { ...
i wondering if there way run integration tests component-annotated-classes different properties file (let's test-config.properties
) in order give different values value , autowired annotated properties , methods.
note: know spring 4.1.x comes @testpropertysource
helps achieve it. upgrading spring later versions not option.
yes. specify "profile" integration tests.
@configuration @propertysource({"classpath:test-config.properties"}) @profile("integration-test") public class myservicetestconfig { ...
in order use profile when testing repository use @activeprofiles
annotation
@activeprofiles("integration-test") @runwith(springjunit4classrunner.class) public class myrepositorytest { ...
Comments
Post a Comment