今天开始Spring源码的学习,年后面试Java高级研发岗,Spring底层的知识是必问知识,而且面试官问的很深入,以前没系统的了解过,现在开始恶补。
在此记录学习过程,不定期更新学习笔记。希望对大家有所帮助。

环境说明

Gradle:5.6

jdk:1.8

Idea:2019.2

构建工具 Gradle

Spring 源码不是使用我们常用的Maven构建,使用Gradle。 Gradle不是我们介绍的重点,我们在本地Window10环境下配置好环境即可。

参考:Gradle的安装与配置(https://www.cnblogs.com/NyanKoSenSei/p/11458953.html)

Spring 源码包准备

  • 下载预编译

从Github下载源码包:我下载的是:spring-framework-5.1.0.RC1.zip,

下载地址:https://github.com/spring-projects/spring-framework/releases

解压文件,查看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 issues1. `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 toIntelliJ 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 fromIntelliJ IDEA. Resolving this is a work in progress. If attempting to run all JUnit tests from withinIntelliJ IDEA, you will likely need to set the following VM options to avoid out of memory errors:    -XX:MaxPermSize=2048m -Xmx2048m -XX:MaxHeapSize=2048m4. If you invoke "Rebuild Project" in the IDE, you'll have to generate some testresources of the `spring-oxm` module again (`./gradlew :spring-oxm:compileTestJava`)    ## TipsIn 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.## FAQQ. 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命令

  • 导入IDEA

import-into-idea.md文件,已经说明了导入步骤:

File -> New -> Project from Existing Sources -> Navigate to directory -> Select build.gradle

然后耐心等待jar包下载完 ….

运行测试

打开SimplePropertyNamespaceHandlerWithExpressionLanguageTests.java,执行单元测试。

到这一步,基本完工,本节的目的只是为了导入spring工程后代码别飘红就行,要不看着报错很糟心。

环境搭建完成!!!!

idea导入spring源码_Spring源码入门到放弃(一):环境准备相关推荐

  1. Spring5.x源码分析 | 从踩坑到放弃之环境搭建

    Spring5.x源码分析--从踩坑到放弃之环境搭建 前言 自从Spring发行4.x后,很久没去好好看过Spring源码了,加上最近半年工作都是偏管理和参与设计为主,在技术细节上或多或少有点疏忽,最 ...

  2. Android -- 带你从源码角度领悟Dagger2入门到放弃(一)

    1,以前的博客也写了两篇关于Dagger2,但是感觉自己使用的时候还是云里雾里的,更不谈各位来看博客的同学了,所以今天打算和大家再一次的入坑试试,最后一次了,保证最后一次了. 2,接入项目 在项目的G ...

  3. spring 源码_spring源码系列(一)——spring循环引用

    众所周知spring在默认单例的情况下是支持循环引用的 为了节省图片大小我把那些可以动得gif图片做成了只循环一次,如果看到图片不动了请右键选择在新标签打开,那么图片就会动,手机用户则更简单,直接手指 ...

  4. batch spring 重复执行_Spring源码高级笔记之——Spring AOP应用

    Spring AOP应用 AOP本质:在不改变原有业务逻辑的情况下增强横切逻辑,横切逻辑代码往往是权限校验代码.日志代码.事务控制代码.性能监控代码. 第1节AOP相关术语 1.1业务主线 在讲解AO ...

  5. spring依赖注入_Spring源码阅读:Spring依赖注入容器

    依赖注入 依赖注入是Spring框架最核心的能力,Spring框架提供的AOP,WebMVC等其它功能都是以依赖注入容器作为基础构建的,Spring依赖注入容器类似于一个用于组装对象的框架内核,任何应 ...

  6. java spring ioc 实例_Spring 源码阅读(IOC容器)-bean的实例化以及注入

    3.Bean的实例化以及注入过程分析 Bean的实例以及注入是在getBean时触发的,由于外部容器是与外部调用交互的桥梁,我们首先从外部容器入手,AbstractApplicationContext ...

  7. java spring源码_spring源码分析-spring中的bean

    接触过spring的人都知道,在spring中我们称java对象为bean,我们在spring的debug日志或者报错日志也能看到各种bean的描述.其实,spring的bean和java的对象之间是 ...

  8. Redis源码阅读,从入门到放弃

    作为后端工程师,我们在面试和工作中都会用到 Redis,特别是大型互联网公司面试时,不仅要求面试者能简单使用 Redis,还要求懂 Redis 源码层面的实现原理,具备解决常见问题的能力.可以说,熟练 ...

  9. Android -- 带你从源码角度领悟Dagger2入门到放弃(三)

    1, 前面两篇文章我们知道了怎么使用常用的四种标签,现在我们结合我们自己的项目中去简单的使用 在我们搭建项目的时候,一般会创建自己的Application,在里面进行一些初始化如一些第三方的Green ...

最新文章

  1. 6个变态的C语言Hello World程序
  2. 用Scikit-learn和TensorFlow进行机器学习(三)
  3. python高斯函数表达式_Python实现高斯函数的三维显示方法
  4. python中文件路径如何读取提示nosuch file_Python 解决相对路径问题:No such file or directory...
  5. Oracle电子商务套件版本12.1.3自述文件 (Doc ID 1534411.1)
  6. rockmq运维指令_RocketMQ 运维指令
  7. 售票系统的组件图和部署图_识读配电箱系统图
  8. 芯片设计中的latch_Latch-up (闩锁效应)
  9. Python 同一个类中不同函数相互调用
  10. JQuery常用方法一览【转】
  11. python爬取知乎文章_selenium+python+BeautifulSoup爬取知乎文章信息
  12. MySQL之视图、触发器、事务、存储过程、函数
  13. Oracle的常用修改表及字段的语句
  14. 批处理中的删除命令:del
  15. 项目经历——地图定位神器
  16. 1688API大全、商品详情调用展示
  17. 【论文阅读】TomoAlign: A novel approach to correcting sample motion and 3D CTF in CryoET
  18. CTF学习-web解题思路
  19. Broccoli Tree Creator 使用说明 3_3、Girth Transform Node (周长变换节点)
  20. 一分钟一个Pandas小技巧(一)

热门文章

  1. AI独角兽云从科技:用人机协同战略,跨AI工程的楚河汉界
  2. 阿里云迎来 2.0,重新定义软件系统应用开发方式
  3. 华为回应申请大量“鸿蒙”商标;5G第一个演进版本标准正式完成;SUSE 收购 Rancher Labs| 极客头条
  4. 2020 年了,不知道这些还怎么做区块链工程师?
  5. 绝了!RNN 还会写藏头诗!
  6. 再获数千万融资,湃方科技将工业智联革命进行到底
  7. 我是如何在六个月内学会 Python 的?
  8. C++ 过去的这一年
  9. 微服务架构的 10个 最佳实践 !
  10. 全中!七大初学者易踩的坑!