Spring源码环境搭建
Spring源码在github上,地址是https://github.com/spring-projects/spring-framework/,选择5.3.x版本,直接从github上克隆项目网速很慢,所以首先将github上的Spring项目导入gitee仓库里,再从gitee克隆项目。
克隆项目后,等待项目构建完毕,时间可能比较长。
新建一个gradle模块myselft-test

在settings.gradle文件加入
include 'myselft-test'
在myselft-test模块build.gradle加入
implementation project(":spring-context")
implementation project(":spring-beans")
在resources目录新建app.xml
点击查看代码
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<beans>
<bean id="person" class="xml.Person">
<property value="张三" name="name"></property>
</bean>
</beans>
</beans>
新建Person.class
点击查看代码
public class Person {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
测试
点击查看代码
public class Main {
public static void main(String[] args) {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:app.xml");
Person person = applicationContext.getBean(Person.class);
System.out.println(person.getName());
}
}
执行结果:

Spring源码环境搭建的更多相关文章
- 【一步一步】Spring 源码环境搭建
平时项目中基本上都会用到spring,但是源码还没有深入的了解过.趁这段时间稍微空闲点,开始研究下spring 源码.下面是spring 源码的环境搭建. 主要分为如下步骤: ①安装jdk,gradl ...
- Spring源码阅读 源码环境搭建(一)
ring 源码阅读的搭建(一) 一 下载spring源码 进入官方网页:https://spring.io/projects/spring-framework 进入相关的github位置,下载zip包 ...
- Ubuntu搭建Spring源码环境常见问题
在一心想要学习Spring框架源码时,我们会遇到很多麻烦的问题.开始本文前,你只需要拥有一个装好IDEA的Ubuntu系统就可以愉快启程了.如果还没有IDEA,可以参考在Ubuntu上安装Intell ...
- Spring 5.2.x 源码环境搭建(Windows 系统环境下)
前期准备 1.确保本机已经安装好了 Git 2.Jdk 版本至少为 1.8 3.安装好 IntelliJ IDEA (其他开发工具,如 eclipse.Spring Tool Suite 等也是可以的 ...
- Linux Kafka源码环境搭建
本文主要讲述的是如何搭建Kafka的源码环境,主要针对的Linux操作系统下IntelliJ IDEA编译器,其余操作系统或者IDE可以类推. 1.安装和配置JDK确认JDK版本至少为1.7,最好是1 ...
- 【ZooKeeper系列】3.ZooKeeper源码环境搭建
前文阅读: [ZooKeeper系列]1.ZooKeeper单机版.伪集群和集群环境搭建 [ZooKeeper系列]2.用Java实现ZooKeeper API的调用 在系列的前两篇文章中,介绍了Zo ...
- MyBatis源码环境搭建
之前研究mybatis都是参考前面学习的人的一些经验,并没有自己搭建源码环境进行.现在以mybatis3.4.6版本搭建,搭建过程中各种failed,下面大致记录环境搭建过程. 1.mybatis3. ...
- 1-web应用之LAMP源码环境搭建
目录 一.LAMP环境的介绍 1.LAMP环境的重要性 2.LAMP组件介绍 二.Apache源码安装 1.下载Apache以及相关依赖包 2.安装Apache以及相关 ...
- Hadoop源码学习笔记之NameNode启动场景流程一:源码环境搭建和项目模块及NameNode结构简单介绍
最近在跟着一个大佬学习Hadoop底层源码及架构等知识点,觉得有必要记录下来这个学习过程.想到了这个废弃已久的blog账号,决定重新开始更新. 主要分以下几步来进行源码学习: 一.搭建源码阅读环境二. ...
随机推荐
- 使用PowerShell下载文件
更新记录 本文迁移自Panda666原博客,原发布时间:2021年7月12日. 使用Invoke-WebRequest指令下载文件 [Net.ServicePointManager]::Securit ...
- javaweb获取客户端真实ip
在安全性要求较高的web项目中,我们经常有这样的需求: 黑名单:禁止指定ip访问. 白名单:允许指定ip访问. 根据ip追踪恶意入侵系统者. 在java中我们通常可以这样获取客户端ip地址: requ ...
- python基础中遇到的问题(TypeError: unhashable type: 'list')
d20220330 #false >>> l=[{i:i+1} for i in [1,2,3]] >>> l [{1: 2}, {2: 3}, {3: 4}] & ...
- 『忘了再学』Shell流程控制 — 34、if条件判断语句(二)
目录 1.多分支if条件语句格式 2.练习 3.说明 4.综合练习 1.多分支if条件语句格式 if [ 条件判断式1 ] then 当条件判断式1成立时,执行程序1 elif [ 条件判断式2 ] ...
- linux服务器通过mailx邮件发送附件到指定邮箱
shell脚本查询数据库#!/bin/bash HOSTNAME="数据库IP" PORT="端口" USERNAME="用户" PASSW ...
- SpringBoot 整合文件上传 elment Ui 上传组件
SpringBoot 整合文件上传 elment Ui 上传组件 本文章记录 自己学习使用 侵权必删! 前端代码 博主最近在学 elment Ui 所以 前端使用 elmentUi 的 upload ...
- python这不是有手就行?——python音频处理基础知识
大家应该都知道声音的基础吧? 啊不知道当我没说吧~~~ 1.声音的基础 2.python读取.wav音频 Python学习交流Q群:660193417#### import wave import s ...
- C#.NET笔试题-高级
1.说说什么是架构模式. 1,分层. 2,分割. 分层是对网站进行横向的切分,那么分割就是对网站进行纵向的切分.将网站按照不同业务分割成小应用,可以有效控制网站的复杂程度. 3,分布式. 在大型网站中 ...
- 把excel的数据导入到SQLSERVER里面,excel的字符串时间在导入sql库显示datetime 数据类型的转换产生一个超出范围的值
这是我Excel导入的数据,准备把这个varchar(50)时间导入我的userInfo表中的出生日期字段datatime,如果你的数据正常,是可以导入的, 但是有些日期可能超出datatime的最大 ...
- Pytorch Dataloader加速
在进行多卡训练的时候,经常会出现GPU利用率上不来的情况,无法发挥硬件的最大实力. 造成这种现象最有可能的原因是,CPU生成数据的能力,已经跟不上GPU处理数据的能力. 方法一 常见的方法为修改Dat ...