Spring源码本地调试环境搭建

news/2024/7/5 1:07:28

1 Gradle 环境

在这里插入图片描述

2 下载源码

git clone --branch v5.2.8.RELEASE https://gitee.com/Z201/spring-framework.git

3 修改文件

在这里插入图片描述

3.1 settings.gradle

pluginManagement {
	repositories {
		gradlePluginPortal()
		maven { url 'https://maven.aliyun.com/repository/public' }
		maven { url 'https://repo.spring.io/plugins-release' }
	}
}

在这里插入图片描述

3.2 gradle.properties

version=5.2.8.RELEASE
org.gradle.jvmargs=-Xmx2048M
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.daemon=true

在这里插入图片描述

3.3 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" }
		}

在这里插入图片描述

4 编译

#spring 源码目录执行命令
gradlew :spring-oxm:compileTestJava

在这里插入图片描述

5 导入Idea

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

6 导入源码

6.1 pom

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <spring.version>5.2.8.RELEASE</spring.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.20</version>
        </dependency>
        <!-- 日志相关依赖 -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.10</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>1.1.2</version>
        </dependency>
    </dependencies>

6.2 StudentBean

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class StudentBean {


    private String name = "rosh";

    private String school = "杜桥中学";

    private String hobby = "篮球";

}

6.3 applicationContext.xml

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:c="http://www.springframework.org/schema/c"
       xsi:schemaLocation="
	http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/aop
	http://www.springframework.org/schema/aop/spring-aop-3.2.xsd"
       default-lazy-init="false">


    <bean id="student" class="com.rosh.bean.StudentBean"/>


</beans>

6.4 RoshTest

public class RoshTest {

    @Test
    public void mainTest(){
        ClassPathXmlApplicationContext applicationContext=new ClassPathXmlApplicationContext("applicationContext.xml");
        StudentBean student = applicationContext.getBean(StudentBean.class);
        System.out.println(student.toString());
    }
}

6.5 源码导入

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述


http://www.niftyadmin.cn/n/4556664.html

相关文章

Mybatis-SQL语句构建器类及日志

SQL语句构建器类 问题 Java程序员面对的最痛苦的事情之一就是在Java代码中嵌入SQL语句。这么来做通常是由于SQL语句需要动态来生成-否则可以将它们放到外部文件或者存储过程中。正如你已经看到的那样&#xff0c;MyBatis在它的XML映射特性中有一个强大的动态SQL生成方案。但有时…

求一个4*4矩阵两对角线元素之和 设计一个程序

||| 提示你一下 但是只应该加一次 中间行的对角线元素重叠 由于当n是奇数的时候 每行上对角线元素的序号相加是n1 对角线的元素在每行上的分布是规律的 共n行 不过思想是从行出发 矩阵由数组array[n][n]表示for(int i0;i<n;i){ if(i (n-1)/2) sum(array[i][i]array[i][n-i-1…

C语言中的for语句

第二个没有打印出来. i); }如你上面写的程序 i);printf ("%d" for (i0;i<100;i){printf ("%d" 如果想要执行两次 i); 答案补充 第一个 ||| for 循环里要循环的语句如果不只一句要用大插号{}括起来.如上 只循环printf("%d"

Spring 中 Xml 属性配置的解析过程

1 工程概述 1.1 pom文件 <properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target><spring.v…

我不太清楚 请高手指导一下 是先学c语言再学c++好还是先学c++再学c语言好

||| C语言 ||| 我觉得还是学习完C言再学C好C言是编程的最基础啊 但是我个人不这样认为 所以建议先学c&#xff1b;但是也有人说学c最后不要学c 比较抽象 但是c是面向对象的 更接近一半人的思维模式 而且是面向过程的 先c后c&#xff1b;这是我的经验c比较基础 一面混淆

Spring Bean 的实例化过程源码解析

引言 概述&#xff1a; Spring Bean 创建源码分析系列 【1】Spring Bean 的实例化过程源码解析 【2】Spring 依赖注入(DI) 源码解析 【3】Spring 三级缓存解决循环依赖 1 工程概述 1.1 pom <properties><project.build.sourceEncoding>UTF-8</project.build…

爬虫--Scrapy框架课程介绍

Scrapy框架课程介绍&#xff1a; 框架的简介和基础使用持久化存储代理和cookie日志等级和请求传参CrawlSpider基于redis的分布式爬虫一scrapy框架的简介和基础使用 a) 概念&#xff1a;为了爬取网站数据而编写的一款应用框架&#xff0c;出名&#xff0c;强大。所谓的框…

关于c语言的一些问题

这样就有默认值了 只要最后包在“ ”中就行了 答案补充 加一个system("y");在原来的那个后面看看 ||| 赋值给变量 system("format d: /y")&#xff1b; ||| 语句应该有&#xff1b;结尾system("format d:")&#xff1b;要设置参数的话直接和dos命…