《SpringBoot》源码分析
《SpringBoot》源码分析
WormholeStack
All problems in computer science can be solved by another level of indirection.
展开
-
《Spring源码分析》IOC的实现
由一个简单的例子引出本文代码如下:user.java@Datapublic class User { private String username; private int id;}userbean.xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://ww原创 2020-12-22 00:36:47 · 298 阅读 · 1 评论 -
《SpringBoot源码分析》@ConditionalOnBean
由示例引出本文的主角首先新建两个Pojo,分别是People和Company/** * @description: People * @Author MRyan * @Date 2020/12/5 14:20 * @Version 1.0 */@Data@ToString@NoArgsConstructor@AllArgsConstructorpublic class People { /** * 姓名 */ private String nam原创 2020-12-05 15:06:09 · 333 阅读 · 0 评论 -
《SpringBoot源码分析》CommandLineRunner
CommandLineRunner有什么用在使用SpringBoot构建项目时,我们通常有一些预先数据的加载。那么SpringBoot提供了一个简单的方式来实现那就是CommandLineRunner。什么是CommandLineRunner?直奔主题:根据源码说明 我们可以通过实现CommandLineRunner接口并重写run方法来达到SpringBoot运行启动之后自动加载实现CommandLineRunner的类,同时我们可以定义多个类同时实现CommandLineRunner接口,通过@原创 2020-12-03 21:40:07 · 283 阅读 · 0 评论 -
《SpringBoot源码分析》 Context初始化流程
不管是XML配置的Context,还是Spring Boot的Context,还是Web服务中的Context,创建后都会调用AbstractApplicationContext类的refresh()方法。定位到AbstractApplicationContext下的refresh()方法,开始分析。整体流程如下: @Override public void refresh() throws BeansException, IllegalStateException { //1 synch原创 2020-08-02 11:39:09 · 1634 阅读 · 1 评论 -
《SpringBoot源码分析》启动流程
源码分析在SpringApplication.run(SystemmanageApplication.class, args) 入口打个断点,debug进去。定位到public ConfigurableApplicationContext run(String… args)方法,开始分析吧public ConfigurableApplicationContext run(String... args) { // 创建并启动计时监控类 StopWatch stopWatch = n原创 2020-07-27 08:44:57 · 2397 阅读 · 0 评论