- 
                Notifications
    You must be signed in to change notification settings 
- Fork 41.6k
Description
I believe that spring.profiles.default property does not work as documented.
Let's consider following two application property files:
application.properties:
spring.profiles.default=profile1
application-profile1.properties:
server.servlet.context-path=/foo
And corresponding application that simply prints server.servlet.context-path and profile values:
@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        ApplicationContext ctx = SpringApplication.run(Application.class, args);
        System.out.println("Context-path: " + ctx.getEnvironment().getProperty("server.servlet.context-path"));
        System.out.println("active profiles: " + Arrays.asList(ctx.getEnvironment().getActiveProfiles()));
        System.out.println("default profiles: " + Arrays.asList(ctx.getEnvironment().getDefaultProfiles()));
    }
}
When run without parameters, I get:
Context-path: null
active profiles: []
default profiles: [profile1]
When run with explicitly selecting profile1 on command line with --spring.profiles.active=profile1, I get:
Context-path: /foo
active profiles: [profile1]
default profiles: [profile1]
My expectation is that in the first (parameter-less) execution, context-path would be /foo because profile1 properties are loaded as default.