溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

怎么搭建spring 源碼調(diào)試環(huán)境

發(fā)布時(shí)間:2021-06-22 16:05:21 來(lái)源:億速云 閱讀:188 作者:Leah 欄目:編程語(yǔ)言

怎么搭建spring 源碼調(diào)試環(huán)境,針對(duì)這個(gè)問(wèn)題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問(wèn)題的小伙伴找到更簡(jiǎn)單易行的方法。

spring 源碼調(diào)試環(huán)境的搭建

  • springboot是在spring framework 基礎(chǔ)上的上層建筑, 學(xué)習(xí)spring自然是從spring framework開(kāi)始.

  • spring framework包含了一堆項(xiàng)目,先看下有哪些項(xiàng)目


怎么搭建spring 源碼調(diào)試環(huán)境


  • 具體的環(huán)境搭建步驟

  1. gradle的安裝,和maven類(lèi)似,下載,解壓,配置環(huán)境變量即可

  2. git clone https://github.com/spring-projects/spring-framework.git 怎么搭建spring 源碼調(diào)試環(huán)境 如果直接下載zip包的話在編譯的時(shí)候會(huì)遇到 Process 'command 'git'' finished with non-zero exit value 128這個(gè)問(wèn)題,應(yīng)該是項(xiàng)目編譯的時(shí)候需要git 更新項(xiàng)目導(dǎo)致的,直接git clone項(xiàng)目就不會(huì)出現(xiàn)這個(gè)問(wèn)題了

  3. 執(zhí)行.\gradlew.bat :spring-oxm:compileTestJava 怎么搭建spring 源碼調(diào)試環(huán)境

  4. idea 引入即可,具體可以查看項(xiàng)目中自帶的import-into-idea.md文件 怎么搭建spring 源碼調(diào)試環(huán)境

  5. 新建一個(gè)model(使用gradle),復(fù)制spring-test 下的build.gradle文件到新建model中

  6. 新建測(cè)試類(lèi)

public class TestClass {
	private String name;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
}
class TestClassTest {

	@Test
	void getName() {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");

		TestClass myTestBean = context.getBean("myTestBean",TestClass.class);

		System.out.println(myTestBean);
	}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">

	<bean id="myTestBean" class="com.zzk.debug.naming.TestClass"/>

</beans>

怎么搭建spring 源碼調(diào)試環(huán)境


  1. 運(yùn)行測(cè)試

怎么搭建spring 源碼調(diào)試環(huán)境


關(guān)于怎么搭建spring 源碼調(diào)試環(huán)境問(wèn)題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒(méi)有解開(kāi),可以關(guān)注億速云行業(yè)資訊頻道了解更多相關(guān)知識(shí)。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI