IDEA建Spring5.1.x源码搭建记录

一,源码下载

https://codeload.github.com/spring-projects/spring-framework/zip/master 

二,gradle下载及配置:

# mac下gradle安装
brew install gradle
# 查看安装目录
brew info gradle    

三,工程配置:

gradle配置
在这里插入图片描述
项目配置
在这里插入图片描述
下载gradle无法自动下载的jar包:展开左侧gradle ——> spring-core ——>other ——>
compileJavaTest 双击直到build successful
在这里插入图片描述
编译项目 运行任意一个spring-context ——>中的test模块
在这里插入图片描述

四,源码导入成功测试:

4.1.spring源码结构:(添加了一个OwnLearnSpring模块,用于学习测试)
在这里插入图片描述
4.2.小demo测试:
domeo目录结构:
在这里插入图片描述
2-1:

package com.learn;

import org.springframework.context.annotation.ComponentScan;

@ComponentScan("com.learn")
public class Appconfig {
}

在这里插入图片描述

2-2:

package com.learn;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class BuildTest {
  public static void main(String[] args) {
  	AnnotationConfigApplicationContext annotationConfigApplicationContext=new AnnotationConfigApplicationContext(Appconfig.class);
  	System.out.println("showGetBean===>"+annotationConfigApplicationContext.getBean(BuildTestService.class));
  }
}

在这里插入图片描述

2-3:

package com.learn;

import org.springframework.stereotype.Service;

@Service
public class BuildTestService {
}

在这里插入图片描述

2-4:
配置文件:

plugins {
    id 'java'
}

group 'org.springframework'
version '5.1.15.BUILD-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    compile(project(":spring-context"))
    testCompile group: 'junit', name: 'junit', version: '4.12'

在这里插入图片描述
3.demo测试成功
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值