36 Star 329 Fork 291

ForFuture Code / Spring源码分析

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 8.45 KB
一键复制 编辑 原始数据 按行查看 历史
ForFuture Code 提交于 2021-10-08 15:42 . 模拟SpringBoot启动应用

starfork

  • IDEA

  • JDK8以上

  • Gradle4.10.3 注:最好不要使用高版本的,或许会存在settings.gradle配置问题

    Spring Framework 5源码研读分析
    从Spring开始走向成功

导入教程:

  1. 🔥下载源码【Spring源码已经经过了处理,下载后按照下面的步骤进行测试
# 如果你想要一个干净的源码环境,请clone init分支
git clone https://gitee.com/zhong96/spring-framework-analysis.git

# 如果你的网比较好,也可以clone github上面的仓库
git clone https://github.com/gqzdev/spring-framework-analysis
  1. idea中导入spring5源码构建时,spring-core模块报错,缺失cglib相关的jar包依赖。

    gradle配置,可以使用自己下载的gradle,也可以用gradle-warpper.properties中的。在这里插入图片描述

为了避免第三方class的冲突,Spring把最新的cglibobjenesis给重新打包(repack)了,它并没有在源码里提供这部分的代码,而是直接将其放在jar包当中,这也就导致了我们拉取代码后出现编译错误。那么为了画过编译,我们要把缺失的jar补回来

添加cglib和objenesis

  1. Aspectj编译问题解决,主要是aspectj关键字Java语法违背,需要使用ajc编译器执行。下面就切换ajc编译器,首先需要下载aspectj,并且安装。
  • 为spring-aspect工程添加Facets属性 为spring-aspect工程添加Facets属性
  • 编译器要改为Ajc,同时要设置Ajc的安装目录,如图1-27所示。记住,要选择到a spec飞jtools.jar这个层面,同时,务必要边择Delegateto Javac选顷,它的作用是只编译AspectJ的Facets项目,而其他则使用JDK代理。如果不勾选,则全部使用Ajc编译,那么会导致编译错误。 编译器要改为Ajc
  1. idea中导入spring5源码构建时,spring-oxm模块报错。

    :bulb:解决办法:在gradle中找到spring-oxm的genCastorgenJaxb命令。 在这里插入图片描述

经过上面的jar修复操作后,在依赖library中应该有以下几个模块!!!!

library依赖

  1. 🧨build finish 在这里插入图片描述

新建一个测试模块(spring-mytest),后面分析源码时都是建立一个相关的module。详细请看!

测试环境搭建

  1. 资源

    SpringIoc

Spring官方文档中文版

Spring Framework

Spring Framework 5.2.0.BUILD-SNAPSHOT API

快速了解

中文:

​ 这是Spring框架的所在地:所有Spring项目的基础。 总体来说,Spring框架和Spring项目系列通常简称为“ Spring”。

​ Spring提供了Java编程语言以外的所有需要,可用于为各种场景和体系结构来创建企业应用程序。 请阅读概述部分作为参考,以获取更完整的介绍。

编码准则

​ 此项目受Spring行为准则的约束。 通过参与,您将遵守此行为准则。 请向spring-code-of-conduct@pivotal.io报告不可接受的行为。

访问二进制文件

​ 有关对工件或分发zip的访问,请参见Spring Framework ArtifactsWiki页面。

文档

​ Spring框架维护参考文档(已发布source),Github wiki页面,以及 API参考。 Spring项目中也有guides and tutorials

从源代码构建

​ 请参阅从源构建Wikipedia页面和CONTRIBUTING.md文件。

保持联系

​ 关注@SpringCentral@SpringFramework及其团队成员。可以在The Spring Blog上找到深入的文章,并通过我们的news feed宣布发布。 )。

执照

​ Spring Framework是在Apache许可的2.0版下发布的。

英文:

This is the home of the Spring Framework: the foundation for all Spring projects. Collectively the Spring Framework and the family of Spring projects is often referred to simply as "Spring".

Spring provides everything required beyond the Java programming language for creating enterprise applications for a wide range of scenarios and architectures. Please read the Overview section as reference for a more complete introduction.

Code of Conduct

This project is governed by the Spring Code of Conduct. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to spring-code-of-conduct@pivotal.io.

Access to Binaries

For access to artifacts or a distribution zip, see the Spring Framework Artifacts wiki page.

Documentation

The Spring Framework maintains reference documentation (published and source), Github wiki pages, and an API reference. There are also guides and tutorials across Spring projects.

Build from Source

See the Build from Source Wikipedia page and the CONTRIBUTING.md file.

Stay in Touch

Follow @SpringCentral, @SpringFramework, and its team members on Twitter. In-depth articles can be found at The Spring Blog, and releases are announced via our news feed.

License

The Spring Framework is released under version 2.0 of the Apache License.

做一个坚持学习的人,加油!:v:

Java
1
https://gitee.com/zhong96/spring-framework-analysis.git
git@gitee.com:zhong96/spring-framework-analysis.git
zhong96
spring-framework-analysis
Spring源码分析
master

搜索帮助