![](https://img-blog.csdnimg.cn/20200213122511986.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
Spring Framework 核心原理与源码解析
在实际的开发过程中使用到的Spring的功能遵循28法则,大部分的开发人员对Spring的很多功能不了解,这就导致在看Spring源码过程不知所云。所以本专栏会以“应用代码”先行,然后剖析其源码,接着画图总结其原理。最终形成整个框架的运行原理图,在工作中深入源码解决问题,HOLD住全场
java硕哥
这个作者很懒,什么都没留下…
展开
-
Spring Framework 核心原理与源码解析-大纲
一、IoC1、AnnotationConfigApplicationContext 功能概述2、AbstractApplicationContext的refresh功能概述2.12.22.32.42.52.62.72.82.92.102.112.122.132.14二、AOP三、事务ConfigurationClassParser parser = new ConfigurationClassParser(this.metadataReaderFactory, thi原创 2020-08-18 23:47:19 · 347 阅读 · 0 评论 -
Spring源码:ConfigFileApplicationListener
/* * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http:/原创 2020-09-17 00:37:14 · 386 阅读 · 0 评论 -
源码:ConfigurationClassParser
/* * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http:/原创 2020-09-13 22:53:07 · 188 阅读 · 0 评论 -
2、根据@FeignClient生成代理类
1、入口探索我们在 app-b 中有几个和Feign相关的注解主启动类上的 @EnableFeignClients 注解UserControllerClient 类上的 @FeignClient("app-a") 注解根据我们 Spring 的知识,我们知道注解 @Enablexxxx 开启xxx功能,一般在这类的注解上都有@Import的注解,同样 EnableFeignClients 注解上也有@Import(FeignClientsRegistrar.class)public @in原创 2020-08-15 17:24:12 · 756 阅读 · 0 评论 -
1、基于Feign的接口调用概述
我们通过一个例子来解析“基于Feign的接口调用”1、示例概述图中有三个服务app-a、app-b、app-a-apiapp-a-api 是 app-a 服务的接口规范,里面定义了一系列的接口app-a 提供一系列的服务,其中包括用户管理服务(User)app-b 也提供了一系列的服务,但其中某些服务需要依赖app-a提供的服务app-a 和app-b 都依赖app-a-api,同时app-b依赖于feign,我们下面看看代码进一步来体会他们之间的依赖关系2、示例代码在给出代码前,我们看原创 2020-08-15 12:48:05 · 371 阅读 · 0 评论 -
Spring源码: Property相关源码
PropertySource(abstract)package org.springframework.core.env;/** * Abstract base class representing a source of name/value property pairs. The underlying * {@linkplain #getSource() source object} may be of any type {@code T} that encapsulates * prope原创 2020-09-17 00:01:26 · 236 阅读 · 0 评论 -
源码:AutoConfigurationImportSelector(EnableAutoConfigurationImportSelector的父类)
/* * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http:/原创 2020-09-13 23:20:56 · 275 阅读 · 0 评论 -
Spring源码 (事务篇) - 整体流程
解析配置文件获取配置文件TXConf的注解:@EnableTransactionManagement注解的注解@Import(TransactionManagementConfigurationSelector.class)递归解析注解的调用栈:collectImports:525, ConfigurationClassParser (org.springframework.context...原创 2020-04-25 16:28:07 · 280 阅读 · 0 评论 -
0 Spring源码解析模板
0、demo1、图解核心流程2、源码解析原创 2020-08-21 14:02:16 · 88 阅读 · 0 评论 -
2、AbstractApplicationContext的refresh功能概述
refresh方法是整个Spring容器的核心,其体现了Spring容器的工作流程refresh方法中调用了12个子方法完成整个工作流程@Override public void refresh() throws BeansException, IllegalStateException { synchronized (this.startupShutdownMonitor) { // 1、Prepare this context for refreshing. prepareRefr原创 2020-08-16 23:16:37 · 472 阅读 · 0 评论 -
2.5、调用后置处理器
在idea中搜索了一下Spring的后置处理器(PostProcessor),找出了下图的几个本文主要来分析红框中标出的两个,也就是在 refresh() 方法的第5步调用的后置处理器1、后置处理器调用的时机2、后置处理器调用的顺序3、一个最重要的后置处理器这个最重要的后置处理器就是 ConfigurationClassPostProcessor1、ConfigurationClassPostProcessor的作用?2、4、案例读源码(1)案例1(2)案例2(3)案例3Sprin原创 2020-08-18 23:54:41 · 306 阅读 · 0 评论 -
2.6、ConfigurationClassPostProcessor 解析配置文件
ConfigurationClassPostProcessor#processConfigBeanDefinitions1、解析流程2、图解流程3、源码// org.springframework.context.annotation.ConfigurationClassPostProcessor#processConfigBeanDefinitionspublic void processConfigBeanDefinitions(BeanDefinitionRegistry registry)原创 2020-08-18 23:53:37 · 123 阅读 · 0 评论 -
2.5.1.1、解析配置
full 类型: 标注了@Configurationlite类型:1、标注了4种注解:@import/@ImportResource/@Component/@ComponentScan2、或者有标注了@Bean 注解的方法原创 2020-08-19 23:02:38 · 135 阅读 · 0 评论 -
2.5.1.2、ImportBeanDefinitionRegistrar 注册BeanDefinition
本文来解析几个问题:1、容器中的ImportBeanDefinitionRegistrar 是何时实例化并调用其接口方法的?2、ImportBeanDefinitionRegistrar 实例化和普通的Bean实例化时机为何不一样?ImportBeanDefinitionRegistrar 顾名思义:导入BD的注册器,也就是说在容器中,他不是普通的Bean,他是注册Bean的Bean,这么说来,他理应该在所有的Bean实例化前就应该实例化。那么ImportBeanDefinitionRegistra原创 2020-08-19 23:01:15 · 138 阅读 · 0 评论 -
11、doCreateBean中的initializeBean
Initialize the given bean instance, applying factory callbacks as well as init methods and bean post processors. Called from createBean for traditionally defined beans, and from initializeBean for ex...原创 2020-08-19 00:17:50 · 255 阅读 · 0 评论 -
合并的bean定义 - MergedBeanDefinition
我们通过获取bean,来看看如何 “合并BeanDefinition”,BeanDefinition在获取bean过程中的作用一句话概括 “合并BeanDefinition” 的过程类似于面向对象中的继承,一个BeanDefinition 继承了另一个BeanDefinition(继承自己没有的,覆盖相同的)1、测试用例1.1、XML配置<?xml version="1.0" enc...原创 2020-04-08 18:05:47 · 2871 阅读 · 0 评论