When I define the active profiles like this:

@ActiveProfiles("a,b")

on a Spring Boot Test (noticed on a @WebMvcTest), the correct profiles are still applied. This is because of https://github.com/spring-projects/spring-boot/blob/e250cce2744ea226761a20bcf2694e6b4244fc0c/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java#L159

I'm reporting this because it actually confused the hell out of me while I was introducing a newbie to Spring (Boot) and testing support etc. I'm actually not sure whether this is supposed to work like this or not, seems to be an unknown side effect, and I'm not sure whether this is really an issue. This would not work, for instance, if there were a profile with a comma in its name - but no idea if this is allowed either.

Comment From: mbhave

I don't think this was intentional. It would indeed not work if the profile name in this case was actually a,b although that doesn't seem like a common use case. However, since there is no documented restriction, I agree that it can be confusing. We could probably use environment.setActiveProfiles instead of TestPropertyValues in the bootstrapper. It would break those relying on this side-effect but it would keep things consistent with the way @ActiveProfiles works.

Comment From: wilkinsona

Closing in favour of #19556.

Comment From: philwebb

The fix we want for this is a little risky for 2.1.x so I'll move this to 2.3.x