1、启动类
package com.imooc.springapplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
@SpringBootApplication
public class SpringApplicationContextBootstrap {
public static void main(String[] args) {
ConfigurableApplicationContext context = new SpringApplicationBuilder(SpringApplicationContextBootstrap.class)
.web(WebApplicationType.SERVLET)
.run(args);
System.out.println("ConfigurableApplicationContext类型:" + context.getClass().getName());
System.out.println("Environment类型:" + context.getEnvironment().getClass().getName());
context.close();
}
}
2、运行结果
ConfigurableApplicationContext类型:org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext
ConfigurableApplicationContext getEnvironment类型:org.springframework.web.context.support.StandardServletEnvironment