spring源码写注释
转:https://blog.csdn.net/z_c8819/article/details/105258015
1.从GitHub上下载spring项目
https://github.com/spring-projects/spring-framework

当然也可以使用git进行下载:
git clone --branch v5.2.2.RELEASE https://github.com/spring-projects/spring-framework.git
我下载的5.2.2

2.安装Gradle
2.1下载Gradle
注意:由于spring源码是基于Gradle所以需要安装配置gradle 注意:jdk版本要1.8及以上版本
gradle下载地址:https://services.gradle.org/distributions/,选择合适的gradle版本,本人用的是6.0的版本

2.2 gradle解压并配置环境变量
直接解压,然后配置环境变量


2.3 配置 GRADLE_USER_HOME

找到一个盘符空间比较大的地方来重新放置.gradle文件
当然也可不用配置,那么下载的.gradle文件会存放在C盘
2.4 验证
cmd 命令下运行:gradle -v

3 编译spring源码
3.1 进入spring源码目录,载目录下有一个import-into-idea.md文件
The following has been tested against IntelliJ IDEA 2016.2.2 ## Steps _Within your locally cloned spring-framework working directory:_ 1. Precompile `spring-oxm` with `./gradlew :spring-oxm:compileTestJava`
2. Import into IntelliJ (File -> New -> Project from Existing Sources -> Navigate to directory -> Select build.gradle)
3. When prompted exclude the `spring-aspects` module (or after the import via File-> Project Structure -> Modules)
4. Code away ## Known issues 1. `spring-core` and `spring-oxm` should be pre-compiled due to repackaged dependencies.
See `*RepackJar` tasks in the build and https://youtrack.jetbrains.com/issue/IDEA-160605).
2. `spring-aspects` does not compile due to references to aspect types unknown to
IntelliJ IDEA. See https://youtrack.jetbrains.com/issue/IDEA-64446 for details. In the meantime, the
'spring-aspects' can be excluded from the project to avoid compilation errors.
3. While JUnit tests pass from the command line with Gradle, some may fail when run from
IntelliJ IDEA. Resolving this is a work in progress. If attempting to run all JUnit tests from within
IntelliJ IDEA, you will likely need to set the following VM options to avoid out of memory errors:
-XX:MaxPermSize=2048m -Xmx2048m -XX:MaxHeapSize=2048m
4. If you invoke "Rebuild Project" in the IDE, you'll have to generate some test
resources of the `spring-oxm` module again (`./gradlew :spring-oxm:compileTestJava`) ## Tips In any case, please do not check in your own generated .iml, .ipr, or .iws files.
You'll notice these files are already intentionally in .gitignore. The same policy goes for eclipse metadata. ## FAQ Q. What about IntelliJ IDEA's own [Gradle support](https://confluence.jetbrains.net/display/IDEADEV/Gradle+integration)? A. Keep an eye on https://youtrack.jetbrains.com/issue/IDEA-53476
里面有一条命令:gradlew :spring-oxm:compileTestJava
3.2 在cmd中进入源码所在目录执行此命令下载jar
此过程会耗时很久,因个人网速情况而定


3.3 使用idea打开spring源码,需要在idea中安装插件kotlin

4.替换jar包
我们需要线在springframework项目里面生成jar包,放入到我们需要的项目中去,这样子我们的项目就可以在源码里面写注释了。
以spring-context为例
4.1 生成jar包
4.1.1 打开gradle窗口

4.1.2 在gradle窗口下找到spring-context的jar包
4.1.3 双击这个jar包
然后在项目里面可以看到生成了一个jar包

4.2 在自己的项目导入刚才生成的jar包
4.2.1 打开自己的项目(注意,使用的spring版本需要和上面的一致)

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.2.RELEASE</version>
</dependency>
</dependencies>
4.2.2 打开External Libraries,找到spring-context的jar包

4.2.3 右键+Open Library Settings

4.2.4 替换class下面的jar包
选择刚才在springframe项目里面生成的jar包

再删除原有的
4.2.5 替换resource下面的
这里只需要选择到spring-context目录即可

删除原来的
5 此时context下面的类全都可以写注释了


其它的jar包同上
spring源码写注释的更多相关文章
- spring源码解析(一) 环境搭建(各种坑的解决办法)
上次搭建spring源码的环境还是两年前,依稀记得那时候也是一顿折腾,奈何当时没有记录,导致两年后的今天把坑重踩了一遍,还遇到了新的坑,真是欲哭无泪;为了以后类似的事情不再发生,这次写下这篇博文来必坑 ...
- Spring学习之——手写Mini版Spring源码
前言 Sping的生态圈已经非常大了,很多时候对Spring的理解都是在会用的阶段,想要理解其设计思想却无从下手.前些天看了某某学院的关于Spring学习的相关视频,有几篇讲到手写Spring源码,感 ...
- Spring学习之——手写Spring源码V2.0(实现IOC、D、MVC、AOP)
前言 在上一篇<Spring学习之——手写Spring源码(V1.0)>中,我实现了一个Mini版本的Spring框架,在这几天,博主又看了不少关于Spring源码解析的视频,受益匪浅,也 ...
- 从零开始手写 spring ioc 框架,深入学习 spring 源码
IoC Ioc 是一款 spring ioc 核心功能简化实现版本,便于学习和理解原理. 创作目的 使用 spring 很长时间,对于 spring 使用非常频繁,实际上对于源码一直没有静下心来学习过 ...
- Spring源码之AbstractApplicationContext中refresh方法注释
https://blog.csdn.net/three_stand/article/details/80680004 refresh() prepareRefresh(beanFactory) 容器状 ...
- Spring源码 20 手写模拟源码
参考源 https://www.bilibili.com/video/BV1tR4y1F75R?spm_id_from=333.337.search-card.all.click https://ww ...
- Spring源码分析——资源访问利器Resource之实现类分析
今天来分析Spring的资源接口Resource的各个实现类.关于它的接口和抽象类,参见上一篇博文——Spring源码分析——资源访问利器Resource之接口和抽象类分析 一.文件系统资源 File ...
- Spring源码分析——资源访问利器Resource之接口和抽象类分析
从今天开始,一步步走上源码分析的路.刚开始肯定要从简单着手.我们先从Java发展史上最强大的框架——Spring...旗下的资源抽象接口Resource开始吧. 我看了好多分析Spring源码的,每每 ...
- spring源码分析(二)Aop
创建日期:2016.08.19 修改日期:2016.08.20-2016.08.21 交流QQ:992591601 参考资料:<spring源码深度解析>.<spring技术内幕&g ...
- 初始化IoC容器(Spring源码阅读)
初始化IoC容器(Spring源码阅读) 我们到底能走多远系列(31) 扯淡: 有个问题一直想问:各位你们的工资剩下来会怎么处理?已婚的,我知道工资永远都是不够的.未婚的你们,你们是怎么分配工资的? ...
随机推荐
- Nginx重写功能(rewrite与location)
一.常用的Nginx 正则表达式 二.访问路由location 2.1location的分类 location 大致可以分为三类: 精准匹配:location = / {} 一般匹配:location ...
- 思维分析逻辑 2 DAY
目录 数据分析多元思维模型 微观能力 中观能力 宏观能力 电商平台分析 整体数据 漏斗模型 互联网金融分析 授信模型 了解芝麻信用分结构 数据源的数据变量 数据处理 游戏数据分析 常规指标 商业化指标 ...
- 字符编码 XUTF
/* * Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved. * Description: 上机编程 ...
- centos8 telnet安装
1. 装包 yum -y install telnet telnet-server 2. 启服务 systemctl enable telnet.socket --now 3. 防火墙开放端口 fir ...
- Velocity模板引擎的的使用示例(入门级)
简单说下这个引擎的两个分支(虽然语言不同调用方法大同小异): 1.Java平台下的:org.apache.velocity 2..Net平台下的:NVelocity 注:本文章不涉及到后端只说模板的使 ...
- jQuery 十三中选择器总结
<body style="overflow: scroll;"> <h1>我的测试</h1> <div id="111" ...
- [.NET学习]EFCore学习之旅 -2 简单的增删改查
1.实例化创建数据库上下文类 首先实例化一个数据库操作上下文类,注意到DbContext实现了IDisposable接口,所以使用using语句,避免内存泄露. 2.插入 以Person类为例,先生成 ...
- 关于Qt的QPixmap中不支持jpg文件格式的问题
问题 Qt部分版本存在不支持jpg,JPEG等图像格式的问题 qDebug()<<QImageWriter::supportedImageFormats(); 这行代码可以查看所支持的图像 ...
- SpringMVC03:SSM整合
一.搭建整合环境 1.ssm整合说明 2.搭建环境 二.Spring框架代码的编写 1.编写Spring框架(处理业务层) applicationContext.xml <?xml versio ...
- 【软考-中级-其他】03、NoSQL和云计算
其他 NoSQL概述 分类 文档存储数据库:MongoDB 采用BSON格式完成存储数据和网络数据交换 BSON格式:JSON的二进制编码格式 逻辑结构包括:数据库.集合(相当于关系数据库的表).文档 ...