先从github上下载spring-framework的源码
https://github.com/spring-projects/spring-framework
然后用IDEA打开选择gradle。
遇到了两个问题:
(1).spring-core下的
package org.springframework.cglib.core;报错,缺少包。
解决方案:
将上述目录下的cglibRepackJar和objenesisRepackJar右键
在Task Activation可以看到
然后刷新项目。
到此缺少的包就加载好了。
(2)
InstrumentationSavingAgent包
import org.springframework.instrument.InstrumentationSavingAgent;报错。
解决方案:
将spring-instrument下的spring-context.gradle中的
optional(project(":spring-instrument"))改为
compile(project(":spring-instrument")),重新加载环境。
到此为止,源码就能跑起来了。spring的学习之路正式开始: