//1、SpringApplication 类
//入口:
public ConfigurableApplicationContext run(String... args) {
...
ConfigurableEnvironment environment = this.prepareEnvironment(listeners, bootstrapContext, applicationArguments);
...
}
private ConfigurableEnvironment prepareEnvironment(SpringApplicationRunListeners listeners, DefaultBootstrapContext bootstrapContext, ApplicationArguments applicationArguments) {
...
this.configureEnvironment((ConfigurableEnvironment)environment, applicationArguments.getSourceArgs());
...
}
protected void configureEnvironment(ConfigurableEnvironment environment, String[] args) {
...
this.configureProfiles(environment, args);
}
protected void configureProfiles(ConfigurableEnvironment environment, String[] args) {
Set<String> profiles = new LinkedHashSet(this.additionalProfiles);
profiles.addAll(Arrays.asList(env
SpringBoot区分环境底层代码逻辑
于 2021-06-15 23:18:00 首次发布