@ActiveProfiles
replaces profiles from SPRING_PROFILES_ACTIVE
environment variable with its value in 2.3.0.M4, but it appends its value to profiles from the environment variable in 2.3.0.RC1.
I'm not sure if this is an intentional change or more appropriate, but I'm sharing this as I didn't see any explicit mention from its release notes or issue assigned to its milestone.
This can be produced with ActiveProfilesTests
from this sample.
If the following environment variable is defined, the test will pass with 2.3.0.M4, but it will fail with 2.3.0.RC1:
export SPRING_PROFILES_ACTIVE=local
Comment From: mbhave
19788 was fixed but #21006 could have introduced something.
Comment From: mbhave
SpringApplication
makes a call to environment.getActiveProfiles()
which has a side-effect of setting active profiles if they haven't been set before. At this point, Spring Framework, sets the active profiles from the spring.profiles.active
. Since the SpringBootContextLoader
adds them as indexed properties now, those do not override SPRING_PROFILES_ACTIVE
at this point.
I think the change made for #21006 also means that if there's a system property such as spring.profiles.active[0]
and an environment variable SPRING_PROFILES_ACTIVE
, the system property won't override the environment variable but instead both will be added as active profiles.