spring 5.2.7 编译
- 环境
idea 2021社区版
jdk8 - 下载spring源码
a、git上下载spring5.2.7 zip包,解压缩
b、修改build.gradle
repositories { maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'} maven{ url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'} mavenCentral() maven { url "https://repo.spring.io/libs-spring-framework-build" } }
c、下载gradle-5.6.4-bin.zip
d、修改gradle\wrapper\ 目录下的gradle-wrapper.properties,注释掉原distributionUrl配置,以免从网上下载gradle。
#distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
distributionUrl=file:///D:/.gradle/wrapper/dists/gradle-5.6.4-bin.zipe、编译compileTestJava模块
执行gradlew.bat或在spring源码根目录里运行windows cmd,执行以下命令
gradlew :spring-oxm:compileTestJava
配置了镜像一般很快(1-3)分钟就能完成,如果要很久说明镜像配置不成功
3. 导入idea
Import into IntelliJ (File -> New -> Project from Existing Sources -> Navigate to directory -> Select build.gradle)
idea配置:
导入后编译需要一段时间。
4 添加测试模块
new->model->gradle-->输入模块名称
@Service public class TestImpl { public void hello(){ System.out.println("Hello Spring!"); } }
@Configuration @ComponentScan("com.test") public class TestClass { public static void main(String[] args) { ApplicationContext context=new AnnotationConfigApplicationContext(TestClass.class); TestImpl bean = context.getBean(TestImpl.class); bean.hello(); } }
5 大功告成
分类:
Java
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
2017-05-09 揭示同步块索引(上):从lock开始