1 前言
参考了https://www.cnblogs.com/hello-shf/p/10976646.html
之后也整理了自己的思路。写博客的时候按照自己的理解来写
1.springboot项目的启动类中含有两个重要部分,以下面为例。
@SpringBootApplication
public class SystemApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SystemApplication.class);
app.run(args);
}
}
代码中有2个重要点:@SpringBootApplication和run方法。
此处先讲run方法。在run()前先初始化SpringApplication的实例。那创建实例里面做了哪些操作呢?看下面:
public SpringApplication(Class<?>... primarySources) {
this(null, primarySources);
}
/**
* Create a new {@link SpringApplication} instance. 创建实例
*/
@SuppressWarnings({
"unchecked", "rawtypes" })
public SpringApplication(ResourceLoader resourceLoader, Class<?>... primarySources) {
this.resourceLoader = resourceLoader