springboot原始碼略讀

2021-09-08 11:45:15 字數 678 閱讀 7429

springboot的精髓是自動依賴注入。那麼哪些能自動注入呢,開啟spring-boot-autoconfigure,jar下的spring.factories。

可以看到一堆這樣的配置:

# auto configure

org.springframework.boot.autoconfigure.enableautoconfiguration=\

org.springframework.boot.autoconfigure.aop.aopautoconfiguration,\

org.springframework.boot.autoconfigure.amqp.rabbitautoconfiguration,\

org.springframework.boot.autoconfigure.batch.batchautoconfiguration,\

org.springframework.boot.autoconfigure.cache.cacheautoconfiguration,\

讓我們隨便點開乙個檔案,aopautoconfiguration,

這裡的就能看到我們能寫在配置檔案裡的配置。

真正的載入原理在

原始碼中的設計模式略讀

找出兩個專案中的設計模式,更加理解設計模式在框架中的應用。專案1 業務場景 當zk中的配置變化的時候,實時通知業務程式。模式 監聽者應用1 curatorlistener 監聽者介面,監聽zk變化 curatorframework 被監聽者 confignodeeventlistener 監聽者實現...

SpringBoot原始碼分析

public class 第乙個引數 resourceloader 資源載入器 第二個引數 primarysources 載入的主要資源類 suppresswarnings public resourceloader resourceloader,class primarysources deduc...

Spring Boot 原始碼分析

1 專案初始化過程 springboot啟動類 springboot的啟動很簡單,如下 public static void main string args this.resourceloader resourceloader initialize sources private void ini...