环境介绍:
spring boot版本:2.6.13
主要starter:spring-boot-starter-web
Spring boot启动主类:
启动很简单只是在main函数中执行SpringApplication.run静态方法
//传入主类的类型和main方法的入参
public static ConfigurableApplicationContext run(Class<?> primarySource, String... args) {
return run(new Class<?>[] { primarySource }, args);
}
/**
* Static helper that can be used to run a {@link SpringApplication} from the
* specified sources using default settings and user supplied arguments.
* @param primarySources the primary sources to load
* @param args the application arguments (usually passed from a Java main method)
* @return the running {@link ApplicationContext}
*/
public static ConfigurableApplicationContext run(Class<?>[] primarySources, String[] args)