原创 JVM(一)- 基本結構和總覽
目錄 1、內存自動管理 2、虛擬機執行子系統 3、JVM與多線程(或者高併發)的重合部分 4、調優實戰、常用參數等 之前看完《深入理解Java虛擬機》第二版之後覺得收穫很大,現在第三版都出來了,書更厚並且增加了很多Java8等的東
原创 Spring Boot源碼(五) - 自動裝配(上)
目錄 1、@SpringBootConfiguration 2、@ComponentScan 3、@ConfigurationPropertiesScan 4、@EnableAutoConfiguration 1)、@AutoConfig
原创 SpringIoc源碼(十九)- BeanFactory(八)- getBean(doCreateBean - populateBean屬性填充)
目錄 1、檢查是否跳過屬性填充 2、根據Autowire模式填充 1)、autowireByName 2)、autowireByType 3、InstantiationAwareBeanPostProcessor#postProcessP
原创 Spring源碼-@ComponentScan原理分析
目錄 一、獲取AnnotationAttributes屬性並且解析 二、doScan 1)、輪訓加載basePackage下的BeanDefinition 1、scanCandidateComponents 2、doFindPathMat
原创 Spring Boot源碼(一) - 分析總覽
Spring Boot當前版本爲2.2.0,之前一直對Spring Boot的各個模塊比較模糊,很難理解自動裝配等註解與容器啓動的關係等。但是後面梳理完了之後發現,Spring Boot只是在Spring的基礎上做了比較多的封裝和
原创 SpringMVC源碼(六)- doDispatch - getHandler獲取HandlerExecutionChain(調用方法和攔截器鏈)
目錄 getHandler 1、匹配HandlerMethod 1)、獲取真實的請求路徑 2)、匹配需要調用的具體方法封裝的HandlerMethod createWithResolvedBean(沒看懂) 2、匹配連接器鏈,組裝返回Ha
原创 Spring源碼 - @Resource、@PostConstruct、@PreDestroy原理分析(CommonAnnotationBeanPostProcessor - 上)
目錄 一、初始化 CommonAnnotationBeanPostProcessor的靜態代碼塊初始化 CommonAnnotationBeanPostProcessor的無參數構造初始化 二、生命週期和回調時機 1、實現了BeanFac
原创 Spring源碼 - @Autowired原理分析(AutowiredAnnotationBeanPostProcessor)
目錄 1、MergedBeanDefinitionPostProcessor#postProcessMergedBeanDefinition 2、#determineCandidateConstructors 3、Instantiatio
原创 @ControllerAdvice使用場景
目錄 1、ExceptionHandler 2、InitBinder 3、ModelAttribute 在Spring MVC進行調用的過程中,會有很多的特殊的需求。比如全局異常,分頁信息和分頁搜索條件,請求時帶來返回時還得回顯頁
原创 SpringIoc源碼(十一)- ApplicationContext(七)- refresh(ConfigurationClassPostProcessor下)
目錄 doProcessConfigurationClass(解析配置類) 1、@Component 2、@PropertySources、@PropertySource 3、@ComponentScans、@ComponentScan
原创 SpringMVC源碼(一)- 總覽 和 ContextLoaderListener監聽啓動WebApplicationContext
目錄 一、SpringMVC總覽 二、ContextLoaderListener的contextInitialized監聽事件 1、創建Web類型的ApplicationContext 2、執行refresh方法 比如下web.x
原创 SpringIoc源碼(十八)- BeanFactory(七)- getBean(doCreateBean - createBeanInstance實例創建)
目錄 1、Supplier方式創建對象 2、工廠方法創建對象 3、有參構造創建對象 4、無參構造創建對象 當創建Bean時,肯定是先通過反射創建該對象。只是Spring除了直接用反射實例化對象外還允許傳入Supplier、
原创 SpringIoc源碼(六)- ApplicationContext(二)- refresh(obtainFreshBeanFactory和StandardEnvironment)
目錄 1、StandardEnvironment 1)、PropertyResolver(Property相關處理) 2)、Environment(Spring profiles相關處理) 3)、ConfigurablePropertyR
原创 SpringIoc源碼(十二)- ApplicationContext(八)- refresh(initMessageSource)
目錄 一、initMessageSource 二、initApplicationEventMulticaster 三、onRefresh 四、registerListeners 一、initMessageSource 國際化相關:
原创 SpringIoc源碼(十七)- BeanFactory(六)- getBean(doCreateBean總覽)
目錄 1、doCreateBean總覽 2、將BeanDefinition轉化爲BeanWrapper 3、MergedBeanDefinitionPostProcessor回調 4、循環依賴實現 5、循環依賴檢查 6、註冊Disposa