spring-reading./README.md

420 lines
29 KiB
Markdown
Raw Normal View History

2023-10-24 02:15:41 +00:00
<div align="center">
<img alt="logo" src="image/banner.png" style="height: 80px">
</div>
2023-10-24 02:48:20 +00:00
<div align="center">
<h2>深入Spring从源码开始</h2>
<h4>探索Java最受欢迎的框架理解它的内部机制带大家从入门到精通。</h4>
</div>
2023-10-23 07:06:39 +00:00
<p align="center">
2023-10-24 02:11:46 +00:00
<a href="https://github.com/xuchengsheng/spring-reading/stargazers"><img src="https://img.shields.io/github/stars/xuchengsheng/spring-reading?logo=github&logoColor=%23EF2D5E&label=Stars&labelColor=%23000000&color=%23EF2D5E&cacheSeconds=3600" alt="Stars Badge"/></a>
<a href="https://github.com/xuchengsheng"><img src="https://img.shields.io/github/followers/xuchengsheng?label=Followers&logo=github&logoColor=%23FC521F&labelColor=%231A2477&color=%23FC521F&cacheSeconds=3600" alt="Follow Badge"></a>
<a href="https://github.com/xuchengsheng/spring-reading/fork"><img src="https://img.shields.io/github/forks/xuchengsheng/spring-reading?label=Forks&logo=github&logoColor=%23F2BB13&labelColor=%23BE2323&color=%23F2BB13" alt="Fork Badge"></a>
<a href="https://github.com/xuchengsheng/spring-reading/watchers"><img src="https://img.shields.io/github/watchers/xuchengsheng/spring-reading?label=Watchers&logo=github&logoColor=%23FF4655&labelColor=%234169E1&color=%23FF4655&cacheSeconds=3600" alt="Watchers Badge"></a>
2023-10-23 07:06:39 +00:00
</p>
2023-10-23 07:28:01 +00:00
<p align="center">
<img src="https://visitor-badge.lithub.cc/badge?page_id=github.com/xuchengsheng&left_text=Visitors" alt="Visitor Badge"/>
<img src="https://img.shields.io/badge/WeChat-xcs19930428-%2307C160?logo=wechat" alt="Wechat Badge"/>
<a href="https://blog.csdn.net/duzhuang2399"><img src="https://img.shields.io/badge/dynamic/xml?url=https%3A%2F%2Fblog.csdn.net%2Fduzhuang2399&query=%2F%2F*%5B%40id%3D%22userSkin%22%5D%2Fdiv%5B1%5D%2Fdiv%5B2%5D%2Fdiv%5B1%5D%2Fdiv%2Fdiv%5B2%5D%2Fdiv%5B1%5D%2Fdiv%5B1%5D%2Fdiv%5B2%5D%2Fspan&logo=C&logoColor=red&label=CSDN&color=red&cacheSeconds=3600" alt="CSDN Badge"></a>
</p>
2023-10-23 07:06:39 +00:00
<p align="center">
2023-10-23 07:37:06 +00:00
<a href="#技术">技术</a>
|
2023-10-23 04:05:04 +00:00
👋 <a href="#简介">简介</a>
|
2023-10-23 09:52:07 +00:00
🍵 <a href="#为何做Spring源码分析">Why</a>
|
2023-10-23 09:45:57 +00:00
🙏 <a href="#顺手点个星">点个星</a>
2023-10-23 04:05:04 +00:00
|
2023-10-23 07:35:37 +00:00
🌱 <a href="#spring-源码阅读系列">Spring源码</a>
|
2023-10-23 04:05:04 +00:00
💬 <a href="#与我联系">联系我</a>
|
<a href="#欢迎贡献">贡献</a>
|
🔄 <a href="#持续更新中">更新</a>
|
2023-10-23 07:22:15 +00:00
💻 <a href="#我的-github-统计">统计</a>
2023-10-23 07:06:39 +00:00
</p>
2023-10-23 07:07:21 +00:00
2023-10-23 04:17:19 +00:00
---
2023-10-23 04:05:04 +00:00
2023-10-07 03:27:49 +00:00
## ⚡技术
2023-09-22 08:07:02 +00:00
2023-10-23 04:05:04 +00:00
<div align="left">
2023-10-23 06:46:29 +00:00
<img src="https://img.shields.io/badge/Java-1.8%2B-%23437291?logo=openjdk&logoColor=%23437291"/>
<img src="https://img.shields.io/badge/Spring-5.3.10-%23437291?logo=Spring&logoColor=%236DB33F&color=%236DB33F"/>
2023-10-24 08:55:16 +00:00
<img src="https://img.shields.io/badge/SpringBoot-2.5.5-%23437291?logo=SpringBoot&logoColor=%236DB33F&color=%236DB33F"/>
2023-10-23 07:23:42 +00:00
<img src="https://img.shields.io/badge/Maven-3.6.3-%23437291?logo=Apache%20Maven&logoColor=%23C71A36&color=%23C71A36"/>
2023-10-23 06:46:29 +00:00
<img src="https://img.shields.io/badge/JSR-330-%2366CCFF?logo=OpenJDK&logoColor=%2366CCFF&color=%2366CCFF"/>
<img src="https://img.shields.io/badge/JSR-250-%23FF9900?logo=OpenJDK&logoColor=%23FF9900&color=%23FF9900"/>
2023-10-23 04:05:04 +00:00
</div>
2023-09-22 09:44:17 +00:00
2023-10-23 07:37:06 +00:00
## 👋简介
2023-10-24 02:20:24 +00:00
大家好呀我是Lex👨💻。我是一名拥有8年经验的Java 后端开发人员👨‍💼,也是一个对 Spring 框架充满热情❤️的程序员。为了帮助那些希望深入了解 Spring 框架的程序员们🧑‍💻,我创建了这个 “Spring 源码阅读系列”📖。通过这个系列,我希望能够与你们共同探索 Spring 的内部工作机制⚙️。如果您有同样的兴趣或问题🤔,请联系我📩!
2023-10-23 07:37:06 +00:00
2023-10-23 09:50:09 +00:00
## 🍵**为何做Spring源码分析**
2023-10-24 02:20:24 +00:00
在我作为框架研发的开发者👨🔬的工作中我经常遇到需要深入理解和调整框架行为的情况🔧。这些工作不只是简单地使用框架的API更多地是需要对框架的内部工作方式有详细的了解🔍。虽然Github上有关于Spring的简化版本📦这些对于入门学习确实有很大的帮助✅但当涉及到真实的项目应用时与真正的Spring框架还是有很大的差异❌。因此我开始深入研究Spring的源码希望能够更透彻地理解其内部的工作机制以便更好地应用到我的实际工作中🧰。分享我的源码分析📝也是为了给那些希望真正理解Spring而不仅仅是使用它的开发者提供一些参考和帮助🙌。
2023-10-23 09:45:57 +00:00
## 🙏顺手点个星
2023-10-24 02:20:24 +00:00
亲爱的朋友们👥我真的花了很多心思💭去研究和整理这个“Spring 源码阅读系列”📘。如果你觉得这东西还不错👍,或者给你带来了一点点帮助🤗,麻烦点一下星星吧🌟。这真的对我意义重大🎖,每一颗星✨都能让我觉得所有的努力都是值得的💪。我知道这是小事一桩,但你的那一下点击🖱,对我来说就是最好的鼓励🎉。无论如何,都要感谢你抽时间🕰阅读我的内容,真的很感激🙏!
2023-10-23 07:37:06 +00:00
2023-09-22 09:44:17 +00:00
## 🌱Spring 源码阅读系列
2023-09-15 07:31:00 +00:00
2023-11-21 08:14:04 +00:00
#### Spring IOC
- 资源加载与访问
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`Resource`](spring-resources/spring-resource/README.md):抽象接口,表示文件、类路径等,用于访问不同来源的资源。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`ResourceLoader`](spring-resources/spring-resource-resourceLoader/README.md):资源获取核心接口,实现统一加载不同位置资源的策略。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
- [`ResourcePatternResolver`](spring-resources/spring-resource-resourcePatternResolver/README.md):资源模式解析接口,用于灵活加载应用中的多种资源。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`DocumentLoader`](spring-resources/spring-resource-documentLoader/README.md)XML文档加载解析核心接口支持后台自动配置Spring应用。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
2023-11-21 08:14:04 +00:00
- 元数据与过滤
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`MetadataReader`](spring-metadata/spring-metadata-metadataReader/README.md)类元数据获取核心支持组件扫描、条件化注解、AOP等高级功能。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`AnnotationMetadata`](spring-metadata/spring-metadata-annotationMetadata/README.md):动态获取和操作运行时类注解信息。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`TypeFilter`](spring-metadata/spring-metadata-typeFilter/README.md):组件扫描时自定义类筛选,支持复杂条件和精确过滤。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`Condition`](spring-metadata/spring-metadata-condition/README.md)条件判断决定Bean创建和配置的灵活机制。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
2023-11-21 08:14:04 +00:00
- Bean定义与注册
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`BeanDefinition`](spring-beans/spring-bean-beanDefinition/README.md)详细描述Bean支持依赖注入、AOP、作用域控制等核心功能。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`BeanDefinitionHolder`](spring-beans/spring-bean-beanDefinitionHolder/README.md)管理和操作BeanDefinition的关键类。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`BeanDefinitionRegistry`](spring-beans/spring-bean-beanDefinitionRegistry/README.md)Bean定义注册管理关键接口处理Bean元数据。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
2023-11-21 08:14:04 +00:00
- Bean定义读取与扫描
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`XmlBeanDefinitionReader`](spring-beans/spring-bean-xmlBeanDefinitionReader/README.md)加载解析XML配置构建IOC容器注册Bean定义。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF6347"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`PropertiesBeanDefinitionReader`](spring-beans/spring-bean-propertiesBeanDefinitionReader/README.md)属性文件加载解析为Bean定义。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF6347"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`GroovyBeanDefinitionReader`](spring-beans/spring-bean-groovyBeanDefinitionReader/README.md)Groovy脚本解析为Bean定义。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF6347"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`AnnotatedBeanDefinitionReader`](spring-beans/spring-bean-annotatedBeanDefinitionReader/README.md)注解配置自动扫描注册Spring组件简化Bean定义配置。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF6347"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`ClassPathBeanDefinitionScanner`](spring-beans/spring-bean-classPathBeanDefinitionScanner/README.md)类路径扫描注册Spring Bean支持自动装配。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF6347"></img>
- 属性解析和环境配置
2023-11-30 08:06:43 +00:00
- [`PropertyResolver`](spring-env/spring-env-propertyResolver/README.md):通用属性解析,获取配置值,处理属性缺失,简便灵活<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
- [`ConfigurablePropertyResolver`](spring-env/spring-env-configurablePropertyResolver/README.md):属性解析配置,占位符设置,适应不同配置需求。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
- `Environment`:应用环境表示,提供属性访问,支持配置文件,实现动态配置。<img src="https://img.shields.io/badge/%E5%8D%B3%E5%B0%86%E6%9B%B4%E6%96%B0-339933"></img>
- `ConfigurableEnvironment`:动态配置应用环境,激活、默认配置,提升应用灵活性。<img src="https://img.shields.io/badge/%E5%8D%B3%E5%B0%86%E6%9B%B4%E6%96%B0-339933"></img>
2023-11-21 08:14:04 +00:00
- Bean定义导入与组合
- `ImportBeanDefinitionRegistrar`:运行时动态注册 Bean实现灵活配置扩展配置类功能。<img src="https://img.shields.io/badge/%E5%8D%B3%E5%B0%86%E6%9B%B4%E6%96%B0-339933"></img>
- `ImportSelector`:运行时动态导入配置类,实现条件选择和灵活配置。<img src="https://img.shields.io/badge/%E5%8D%B3%E5%B0%86%E6%9B%B4%E6%96%B0-339933"></img>
- `DeferredImportSelector`:运行时动态导入配置,支持条件选择和按组别延迟加载。<img src="https://img.shields.io/badge/%E5%8D%B3%E5%B0%86%E6%9B%B4%E6%96%B0-339933"></img>
2023-11-21 08:14:04 +00:00
- Bean工厂
2023-11-21 08:34:41 +00:00
2023-11-28 08:17:07 +00:00
- [`BeanFactory`](spring-factory/spring-factory-beanFactory/README.md)Spring的核心接口提供对Bean的配置、创建、管理的基本功能。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF6347"></img>
2023-11-21 08:34:41 +00:00
2023-11-28 09:40:33 +00:00
- [`ListableBeanFactory`](spring-factory/spring-factory-listableBeanFactory/README.md)支持按类型获取Bean的集合。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF6347"></img>
2023-11-21 08:34:41 +00:00
2023-11-28 09:40:33 +00:00
- [`HierarchicalBeanFactory`](spring-factory/spring-factory-hierarchicalBeanFactory/README.md)支持父子容器关系实现Bean定义的层次结构。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF6347"></img>
2023-11-21 08:34:41 +00:00
- [`ConfigurableBeanFactory`](spring-factory/spring-factory-configurableBeanFactory/README.md)提供对BeanFactory配置的扩展如属性编辑器、作用域等。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF6347"></img>
+ [`AutowireCapableBeanFactory`](spring-factory/spring-factory-autowireCapableBeanFactory/README.md)Bean创建、初始化、注入、销毁的核心功能接口。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF6347"></img>
+ [`ConfigurableListableBeanFactory`](spring-factory/spring-factory-configurableListableBeanFactory/README.md)支持配置和列表操作的可配置Bean工厂接口。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF6347"></img>
2023-11-21 08:14:04 +00:00
- 基于Java的配置
2023-11-21 08:34:41 +00:00
2023-11-21 08:22:16 +00:00
- `ConfigurationClassPostProcessor`:处理@Configuration注解关键容器启动后置处理器。<img src="https://img.shields.io/badge/%E5%8D%B3%E5%B0%86%E6%9B%B4%E6%96%B0-339933"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 08:22:16 +00:00
- `ConfigurationClassParser`:解析@Configuration提取Config信息支持@Bean和条件化配置。<img src="https://img.shields.io/badge/%E5%8D%B3%E5%B0%86%E6%9B%B4%E6%96%B0-339933"></img>
2023-11-21 08:14:04 +00:00
- 容器上下文
2023-11-21 08:34:41 +00:00
- [`ClassPathXmlApplicationContext`](spring-context/spring-context-classPathXmlApplicationContext/README.md)类路径classpath加载 XML 配置文件的上下文。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
2023-11-21 08:34:41 +00:00
- [`AnnotationConfigApplicationContext`](spring-context/spring-context-annotationConfigApplicationContext/README.md):注解配置类中加载配置信息的上下文。<img src="https://img.shields.io/badge/Level-%E7%AE%80%E5%8D%95-0099ff"></img>
2023-11-21 08:34:41 +00:00
- `GenericApplicationContext`支持多种配置方式XML、注解、手动注册的上下文。<img src="https://img.shields.io/badge/%E5%8D%B3%E5%B0%86%E6%9B%B4%E6%96%B0-339933"></img>
2023-11-21 08:14:04 +00:00
- Bean生命周期
2023-11-21 08:34:41 +00:00
2023-11-22 03:53:09 +00:00
- [`Bean的定义注册过程`](spring-core/spring-core-registerBeanDefinition)加载与解析配置文件注册解析Bean定义类名、作用域、属性等。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`Bean的初始化过程`](spring-core/spring-core-getBean/README.md)实例化、属性注入、Aware回调、后置处理器、初始化方法调用、Bean就绪。<img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`Bean的依赖解析过程`](spring-core/spring-core-resolveDependency/README.md):声明依赖,查找依赖,注入依赖,处理循环依赖,延迟依赖解析。<img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:34:41 +00:00
2023-11-22 09:27:37 +00:00
- [`Bean的销毁过程`](spring-core/spring-core-destroyBean/README.md)销毁方法调用接口回调后处理清理通知触发GC回收资源。<img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:14:04 +00:00
- Bean初始化与扩展点
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`InitializingBean`](spring-interface/spring-interface-initializingBean/README.md)提供Bean初始化时执行自定义逻辑的接口。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`DisposableBean`](spring-interface/spring-interface-disposableBean/README.md)定义Bean销毁前执行清理操作的接口。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`BeanDefinitionRegistryPostProcessor`](spring-interface/spring-interface-beanDefinitionRegistryPostProcessor/README.md)在容器启动时对BeanDefinition进行动态修改或添加。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`BeanFactoryPostProcessor`](spring-interface/spring-interface-beanFactoryPostProcessor/README.md)在Bean实例化前对BeanFactory进行全局修改或配置。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`BeanPostProcessor`](spring-interface/spring-interface-beanPostProcessor/README.md)在Bean初始化前后进行自定义处理可影响所有Bean。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`InstantiationAwareBeanPostProcessor`](spring-interface/spring-interface-instantiationAwareBeanPostProcessor/README.md):提供更深层次的实例化和属性注入控制。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`DestructionAwareBeanPostProcessor`](spring-interface/spring-interface-destructionAwareBeanPostProcessor/README.md) 允许在Bean销毁前进行额外的清理操作。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`MergedBeanDefinitionPostProcessor`](spring-interface/spring-interface-mergedBeanDefinitionPostProcessor/README.md)在合并Bean定义时对BeanDefinition进行进一步处理。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`SmartInstantiationAwareBeanPostProcessor`](spring-interface/spring-interface-smartInstantiationAwareBeanPostProcessor/README.md):提供更智能的实例化控制。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
- [`SmartInitializingSingleton`](spring-interface/spring-interface-smartInitializingSingleton/README.md)在所有单例Bean初始化完成后执行自定义逻辑。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:14:04 +00:00
- Aware接口系列
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`BeanNameAware`](spring-aware/spring-aware-beanNameAware/README.md)让Bean获取自身在容器中的名字。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`BeanClassLoaderAware`](spring-aware/spring-aware-beanClassLoaderAware/README.md)允许Bean获取其类加载器。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`BeanFactoryAware`](spring-aware/spring-aware-beanFactoryAware/README.md)提供Bean获取所属的BeanFactory。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`EnvironmentAware`](spring-aware/spring-aware-environmentAware/README.md)允许Bean获取应用程序环境配置。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`EmbeddedValueResolverAware`](spring-aware/spring-aware-embeddedValueResolverAware/README.md)允许Bean解析嵌入式值占位符。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`ResourceLoaderAware`](spring-aware/spring-aware-beanClassLoaderAware/README.md)允许Bean获取资源加载器。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`ApplicationEventPublisherAware`](spring-aware/spring-aware-applicationEventPublisherAware/README.md)允许Bean发布应用程序事件。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`MessageSourceAware`](spring-aware/spring-aware-messageSourceAware/README.md)允许Bean获取消息源。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`ApplicationStartupAware`](spring-aware/spring-aware-applicationStartupAware/README.md)允许Bean获取应用程序启动信息。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`ApplicationContextAware`](spring-aware/spring-aware-applicationContextAware/README.md)允许Bean获取应用程序上下文。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:14:41 +00:00
- [`ImportAware`](spring-aware/spring-aware-importAware/README.md):允许被导入的配置类获取导入它的类的信息。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:14:04 +00:00
- 核心注解
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`@Configuration`](spring-annotation/spring-annotation-configuration/README.md)声明类为配置类定义Bean和Bean之间的依赖关系。<img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`@ComponentScan`](spring-annotation/spring-annotation-componentScan/README.md):启用组件扫描,自动发现并注册标记为组件的类。<img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`@Bean`](spring-annotation/spring-annotation-bean/README.md)在配置类中声明方法返回Bean实例。<img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`@Import`](spring-annotation/spring-annotation-import/README.md)引入其他配置类将其Bean定义合并到当前容器。<img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`@PropertySource`](spring-annotation/spring-annotation-propertySource/README.md):指定属性文件,加载外部配置到环境中。<img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`@DependsOn`](spring-annotation/spring-annotation-dependsOn/README.md)指定Bean的依赖顺序确保特定Bean在其他Bean之前初始化。<img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`@Conditional`](spring-annotation/spring-annotation-conditional/README.md)根据条件决定是否创建Bean。<img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`@Lazy`](spring-annotation/spring-annotation-lazy/README.md)指定Bean的延迟初始化只有在首次使用时才创建。<img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`@Value`](spring-annotation/spring-annotation-value/README.md)注入简单值或表达式到Bean的字段或方法参数。<img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- [`@Autowired`](spring-annotation/spring-annotation-autowired/README.md)自动装配Bean依赖。<img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- `@Primary`指定在多个候选Bean中优先选择的首选Bean。<img src="https://img.shields.io/badge/%E5%8D%B3%E5%B0%86%E6%9B%B4%E6%96%B0-339933"></img><img src="https://img.shields.io/badge/Level-%E5%9B%B0%E9%9A%BE-%23FF3030"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- `@Description`为Bean提供描述性信息。<img src="https://img.shields.io/badge/%E5%8D%B3%E5%B0%86%E6%9B%B4%E6%96%B0-339933"></img><img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- `@Role`为Bean提供角色提示用于区分相似类型的Bean。<img src="https://img.shields.io/badge/%E5%8D%B3%E5%B0%86%E6%9B%B4%E6%96%B0-339933"></img><img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- `@Indexed` 标记Bean用于索引。<img src="https://img.shields.io/badge/%E5%8D%B3%E5%B0%86%E6%9B%B4%E6%96%B0-339933"></img><img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:34:41 +00:00
2023-11-21 09:10:26 +00:00
- `@Order`指定Bean的加载顺序。<img src="https://img.shields.io/badge/%E5%8D%B3%E5%B0%86%E6%9B%B4%E6%96%B0-339933"></img><img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:14:04 +00:00
- JSR规范
2023-11-21 08:29:11 +00:00
2023-11-21 09:10:26 +00:00
- [`@Inject`](spring-jsr/spring-jsr330-inject/README.md)JSR-330标准的依赖注入注解。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:29:11 +00:00
2023-11-21 09:10:26 +00:00
- [`@Named`](spring-jsr/spring-jsr330-named/README.md)JSR-330标准的命名注解。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:29:11 +00:00
2023-11-21 09:10:26 +00:00
- [`@Resource`](spring-jsr/spring-jsr250-resource/README.md)Java EE标准的资源注入注解。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:29:11 +00:00
2023-11-21 09:10:26 +00:00
- [`@Qualifier`](spring-jsr/spring-jsr330-qualifier/README.md)用于限定注入的Bean。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:29:11 +00:00
2023-11-21 09:10:26 +00:00
- [`@Scope`](spring-jsr/spring-jsr330-scope/README.md)指定Bean的作用域。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:29:11 +00:00
2023-11-21 09:10:26 +00:00
- [`@Singleton`](spring-jsr/spring-jsr330-singleton/README.md)指定Bean为单例。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:29:11 +00:00
2023-11-21 09:10:26 +00:00
- [`@PostConstruct`](spring-jsr/spring-jsr250-postConstruct/README.md):指定初始化方法。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:29:11 +00:00
2023-11-21 09:10:26 +00:00
- [`@PreDestroy`](spring-jsr/spring-jsr250-preDestroy/README.md):指定销毁方法。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:29:11 +00:00
2023-11-30 08:06:43 +00:00
- [`Provider`](spring-jsr/spring-jsr330-provider/README.md)Java标准库提供的通用Bean工厂接口。<img src="https://img.shields.io/badge/Level-%E4%B8%80%E8%88%AC-%23FF8C69"></img>
2023-11-21 08:14:04 +00:00
#### Spring AOP
+ AOP 术语Aspect、Join point、Advice、Pointcut 等
2023-11-21 08:28:02 +00:00
2023-11-21 08:14:04 +00:00
+ Spring AOP 实现原理
2023-11-21 08:28:02 +00:00
2023-11-21 08:14:04 +00:00
+ 动态代理JDK 与 CGLIB
2023-11-21 08:28:02 +00:00
2023-11-21 08:14:04 +00:00
+ @AspectJ 支持与使用
2023-11-21 08:28:02 +00:00
2023-11-21 08:14:04 +00:00
+ 切点表达式解析
#### Spring 事件机制
+ 事件的发布与监听
2023-11-21 08:28:02 +00:00
2023-11-21 08:14:04 +00:00
+ 自定义事件
#### Spring 事务管理
+ Spring 事务管理介绍
2023-11-21 08:28:02 +00:00
2023-11-21 08:14:04 +00:00
+ 编程式与声明式事务
2023-11-21 08:28:02 +00:00
2023-11-21 08:14:04 +00:00
+ @Transactional 注解解析
2023-11-21 08:28:02 +00:00
2023-11-21 08:14:04 +00:00
+ 事务传播行为
2023-11-21 08:28:02 +00:00
2023-11-21 08:14:04 +00:00
+ 事务隔离级别
2023-11-21 08:28:02 +00:00
2023-11-21 08:14:04 +00:00
+ 事务管理器实现原理
#### Spring MVC
2023-11-23 06:25:16 +00:00
- `@Controller`:定义类为 Spring MVC 控制器,处理请求并返回视图。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@RequestMapping`:映射请求 URL 到处理方法。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@RequestMapping`:简化 HTTP 方法映射注解,处理 GET、POST、PUT 和 DELETE 请求。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@RequestParam`:绑定请求参数到方法参数。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@PathVariable`:提取 URI 中的模板变量。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@RequestBody`:绑定请求体内容到方法参数,通常用于处理 POST 请求中的 JSON 数据。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@ResponseBody`:将方法返回值直接写入 HTTP 响应体。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@ModelAttribute`:将方法返回值或参数添加到模型,使其在视图中可访问。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@SessionAttribute`:指定模型属性存储在会话中,以在多个请求之间共享。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@InitBinder`:定制数据绑定过程,例如将字符串转换为日期。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@Validated`:类级别注解,标记验证组。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@ResponseBodyAdvice`:全局定制控制器方法返回值的处理。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@RestController`:定义类为 RESTful 控制器,直接将每个方法的返回值写入响应体。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@RequestMappingHandlerMapping`:配置自定义的请求映射处理器。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@SessionAttributes`:控制器类上标记,指定哪些模型属性存储在会话中,用于在多个请求中共享。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@ModelAttribute`:在方法级别和参数级别使用,将模型属性绑定到方法参数,实现数据传递。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@SessionAttribute`:将模型属性存储在会话中,实现在多个请求中的数据共享。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@InitBinder`:在类和方法级别使用,定制数据绑定过程,例如字符串转日期。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@Validated`:类级别注解,标记验证组,与验证框架一起使用。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@ResponseBodyAdvice`:全局处理控制器方法返回值,用于定制响应体逻辑。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@RestController`:类似于 @Controller,专注于 RESTful 服务,直接将方法返回值写入响应体。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
- `@RequestMappingHandlerMappin`g配置自定义请求映射处理器用于个性化 URL 映射逻辑。
2023-11-21 08:14:04 +00:00
#### Spring Boot
2023-11-23 06:25:16 +00:00
+ `@SpringBootApplication`:启动类标识,包含了组合注解 。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
+ `@EnableAutoConfiguration`:启用 Spring Boot 的自动配置。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
+ `@ConfigurationProperties`:将配置文件中的属性值注入到配置类的属性中。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
+ `@EnableCaching`:启用缓存支持。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
+ `@Async`:异步方法注解。
2023-11-23 06:29:33 +00:00
2023-11-23 06:25:16 +00:00
+ `@EventListener`:监听事件。
2023-11-21 08:14:04 +00:00
#### Spring Cloud
- `@EnableDiscoveryClient`:启用服务发现客户端,用于将服务注册到服务注册中心(例如 Eureka
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@EnableEurekaServer`:启用 Eureka 服务端,用于搭建服务注册中心。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@LoadBalanced`:启用负载均衡,通常用于 RestTemplate 和 WebClient使其具备负载均衡的能力。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@FeignClient`:声明一个声明式的 HTTP 客户端,简化了服务调用的过程。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@EnableCircuitBreaker`:启用断路器,用于防止分布式系统中的雪崩效应。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@HystrixCommand`:定义一个熔断器命令。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@EnableZuulProxy`:启用 Zuul API 网关代理。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@ZuulRoute`:用于配置 Zuul 路由。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@EnableConfigServer`:启用配置中心服务端。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@RefreshScope`:用于刷新配置,通常与 Spring Cloud Config 配合使用。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@EnableZipkinServer`:启用 Zipkin 服务器,用于分布式链路追踪。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@EnableBinding`:绑定消息通道,与 Spring Cloud Stream 配合使用。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@GlobalTransactional`:全局事务注解,与 Seata 等分布式事务框架配合使用。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@SentinelResource`Sentinel 限流和熔断注解。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@DubboTransported`:用于 Dubbo 服务的注解。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
- `@NacosInjected`:用于注入 Nacos 相关的实例。
2023-11-21 08:27:10 +00:00
2023-11-21 08:14:04 +00:00
#### Spring 编程风格与设计模式
+ 设计模式在 Spring 源码中的应用
2023-11-21 08:28:02 +00:00
2023-11-21 08:14:04 +00:00
+ Spring 源码阅读技巧
2023-10-23 07:35:37 +00:00
## 💬与我联系
✉️ [Email](xuchengshengsuper@163.com) | 💬 [Issue](https://github.com/xuchengsheng/spring-reading/issues) | 🌐 [CSDN](https://blog.csdn.net/duzhuang2399?type=blog) Me about everything!
## ⛵欢迎贡献!
2023-10-24 08:55:16 +00:00
如果你发现任何错误🔍或者有改进建议🛠️,欢迎提交 issue 或者 pull request。你的反馈📢对于我非常宝贵💎
2023-10-23 07:35:37 +00:00
2023-10-11 01:41:56 +00:00
## 🔄持续更新中
2023-10-24 08:55:16 +00:00
为了给大家提供最新🌱、最有价值的内容💼,我会坚持每天更新这个仓库⏳。每一天,你都可以期待看到一些新的内容或者对已有内容的改进✨。如果你有任何建议或反馈📣,欢迎随时联系我📞。我非常珍视每一个反馈💌,因为这是我持续改进的动力🚀。
2023-10-11 02:32:05 +00:00
2023-10-18 14:46:58 +00:00
## 💻我的 GitHub 统计
2023-10-11 02:32:05 +00:00
2023-10-23 10:04:28 +00:00
[![Star History Chart](https://api.star-history.com/svg?repos=xuchengsheng/spring-reading&type=Date)](https://star-history.com/#xuchengsheng/spring-reading&Date)
## 🍱请我吃盒饭?
2023-10-24 08:55:16 +00:00
作者晚上还要写博客✍️,平时还需要工作💼,如果帮到了你可以请作者吃个盒饭🥡
2023-10-23 10:04:28 +00:00
<div>
2023-10-26 07:52:42 +00:00
<img alt="logo" src="image/WeChatPay.png" style="width: 370px;height: 400px">
<img alt="logo" src="image/Alipay.png" style="width: 370px;height: 400px">
2023-10-23 10:04:28 +00:00
</div>
2023-11-20 02:15:54 +00:00
2023-11-20 02:03:42 +00:00
## 👥加入我们
欢迎加入我们的群聊!一起探讨、分享和学习吧! 🌐
<div>
<img alt="logo" src="image/wechat-group.jpg" style="width: 344px;height: 483px">
</div>