spring - override spring.profiles.active with @ActiveProfiles
10:32 09 Aug 2018

Each of my tests is annotated with

@TestPropertySource(locations = "classpath:application-test.properties")

The content of application-test.properties file starts with spring.profiles.active=... If this is set to testdev, it will override properties by matching properties found in application-testdev.properties and analogously if set to testuat, it will override with application-testuat.properties.

Some of the tests however really only make sense if testuat is set, so I annotated them additionally with @ActiveProfiles("testuat"). When I run it with spring.profiles.active=testdev set in application-test.properties it actually seems to ignore the testuat properties and only read the base properties and the testdev properties.

Is there a way to override spring.active.profiles with @ActiveProfiles ?

Thanks for the help

spring spring-boot