See https://github.com/spring-projects/spring-boot/issues/15344 for the current, slightly surprising, behaviour.

Comment From: mbhave

The behavior is different if the property source that sets spring.profiles.include is a config file and a property source with lower precedence sets spring.profiles.active. In this case, even though the property source with higher precedence contains spring.profiles.include, both the included and active profiles are present in the environment.

See #15445.