As found while debugging the sample in #48399, we're setting active profiles too late for the environment to take effect.
This results in application-specific files not to be considered unless the profile is explicitly provided on the command line. This goes in the way of what we did in framework to retain profiles that are enabled during AOT processing (see spring-projects/spring-framework#30421).
Because the activation of the profile is in framework, there's not much we can do as the environment is prepared before we initialize the context. We'll either have to document that as a limitation or provide a contribution of our own. An EnvironmentProcessor registered in spring.factories is probably the best we can do.