您好,登錄后才能下訂單哦!
怎么搭建spring 源碼調(diào)試環(huán)境,針對(duì)這個(gè)問(wèn)題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問(wèn)題的小伙伴找到更簡(jiǎn)單易行的方法。
springboot是在spring framework 基礎(chǔ)上的上層建筑, 學(xué)習(xí)spring自然是從spring framework開(kāi)始.
spring framework包含了一堆項(xiàng)目,先看下有哪些項(xiàng)目
具體的環(huán)境搭建步驟
gradle的安裝,和maven類(lèi)似,下載,解壓,配置環(huán)境變量即可
git clone https://github.com/spring-projects/spring-framework.git 如果直接下載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)題了
執(zhí)行.\gradlew.bat :spring-oxm:compileTestJava
idea 引入即可,具體可以查看項(xiàng)目中自帶的import-into-idea.md
文件
新建一個(gè)model(使用gradle),復(fù)制spring-test 下的build.gradle文件到新建model中
新建測(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>
運(yùn)行測(cè)試
關(guān)于怎么搭建spring 源碼調(diào)試環(huán)境問(wèn)題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒(méi)有解開(kāi),可以關(guān)注億速云行業(yè)資訊頻道了解更多相關(guān)知識(shí)。
免責(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)容。