Yihsi


  • Home

  • About

  • Archives

  • Tags
Yihsi

Spring Boot 应用启动过程分析

Posted on 2020-03-14 |

对于 Spring Boot 应用来说,不管是直接运行调用了 SpringApplication#run(Class, String[]) 的 main 方法来启动 Spring Boot 应用,还是通过传统方式(参见 SpringBootServletInitializer 和 SpringServletContainerInitializer),将应该打包成 war 包放到 Web 容器中去运行,最终都会调用 SpringApplication#run(String...) 方法来启动应用、创建和刷新 ApplicationContext 。

下面先看 SpringApplication#run(String...) 方法:

Read more »
Yihsi

Java 静态初始化块、初始化块与构造器

Posted on 2019-06-11 |

我们知道在 Java 中,当使用 new 操作符创建一个类的对象时,会依次调用该类的静态初始化块、初始化块和构造器。比如下面这个类:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public class Super {
// 静态初始化块
static {
System.out.println("static init block in class Super");
}
// 初始化块
{
System.out.println("init block in class Super");
}
public Super() {
System.out.println("constructor in class Super");
}
}

Read more »
Yihsi

使用 Gretty 在 IDEA 中运行 Spring Web 项目

Posted on 2018-06-30 |

由于 IDEA Community 版本不支持配置 Tomcat、Jetty 之类的 Web Server,所以使用此版本的 IDEA 要借助插件来进行 Spring Web MVC 应用的开发。之前有使用过 tomcat7-maven-plugin,所以在使用 Gradle 和 Jetty 的时候就去搜索是否有类似的插件,然后就找到了 Gretty 。

下面就是我整理的 Gretty 插件的配置文件 gretty.plugin ,支持 Debug:

Read more »
Lemuel Li

Lemuel Li

3 posts
6 tags
Github Twitter
© 2020 Lemuel Li
Powered by Hexo
Theme - NexT.Pisces