最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Idea 搭建Spring源碼環(huán)境的超詳細(xì)教程

 更新時(shí)間:2020年10月13日 11:28:06   作者:Aska小強(qiáng)  
這篇文章主要介紹了Idea 搭建Spring源碼環(huán)境,本文通過(guò)圖文并茂的形式給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

本篇主要講解如何使用Ideal 搭建Spring的源碼環(huán)境,想必大家都會(huì)多多少少去看過(guò)Spring的部分源碼,一般我們都是直接點(diǎn)進(jìn)某個(gè)Spring類 然后Idea上面去下載 ,但是確實(shí)比較麻煩,而且不能添加自己對(duì)源碼的注釋 理解 ,本篇就來(lái)解決這個(gè)問(wèn)題,手把手使用Idea 搭建Spring framework ,并且直接在Spring framework項(xiàng)目中添加我們自己的module 來(lái)驗(yàn)證環(huán)境是否正確。 本過(guò)程會(huì)比較耗時(shí) 而且容易出錯(cuò) 慢慢來(lái)吧。

1. clone spring-framework 項(xiàng)目

1.1 找到github spring-framwwork 項(xiàng)目

先登錄github 找到 spring-framework項(xiàng)目

https://github.com/spring-projects

image-20200924100101919

我選擇的是 5.0.x

image-20200924100152972

如果你覺得你網(wǎng)速可以,那你可以直接從 github clone 下來(lái), 我這里先把項(xiàng)目傳到 gitee

1.2 fork 到gitee 碼云

image-20200924100520958

拉取你要的 分支 git clone -b 分支

image-20200924101002192

2. 查看 import-into-idea.md 文件

在下載的源碼中 有一個(gè)文件是 import-into-idea 的 md文件 里面有關(guān)于導(dǎo)入 idea需要的 注意事項(xiàng),我們來(lái)打開它

The following has been tested against IntelliJ IDEA 2016.2.2

## Steps

_Within your locally cloned spring-framework working directory:_

1. Precompile `spring-oxm` with `./gradlew :spring-oxm:compileTestJava`
2. Import into IntelliJ (File -> New -> Project from Existing Sources -> Navigate to directory -> Select build.gradle)
3. When prompted exclude the `spring-aspects` module (or after the import via File-> Project Structure -> Modules)
4. Code away

## Known issues

1. `spring-core` and `spring-oxm` should be pre-compiled due to repackaged dependencies.
See `*RepackJar` tasks in the build and https://youtrack.jetbrains.com/issue/IDEA-160605).
2. `spring-aspects` does not compile due to references to aspect types unknown to
IntelliJ IDEA. See https://youtrack.jetbrains.com/issue/IDEA-64446 for details. In the meantime, the
'spring-aspects' can be excluded from the project to avoid compilation errors.
3. While JUnit tests pass from the command line with Gradle, some may fail when run from
IntelliJ IDEA. Resolving this is a work in progress. If attempting to run all JUnit tests from within
IntelliJ IDEA, you will likely need to set the following VM options to avoid out of memory errors:
 -XX:MaxPermSize=2048m -Xmx2048m -XX:MaxHeapSize=2048m
4. If you invoke "Rebuild Project" in the IDE, you'll have to generate some test
resources of the `spring-oxm` module again (`./gradlew :spring-oxm:compileTestJava`) 


## Tips

In any case, please do not check in your own generated .iml, .ipr, or .iws files.
You'll notice these files are already intentionally in .gitignore. The same policy goes for eclipse metadata.

## FAQ

Q. What about IntelliJ IDEA's own [Gradle support](https://confluence.jetbrains.net/display/IDEADEV/Gradle+integration)?

A. Keep an eye on https://youtrack.jetbrains.com/issue/IDEA-53476

大致意思就是

2.1 在源碼目錄下執(zhí)行

 ./gradlew :spring-oxm:compileTestJava

image-20200908133100199

image-20200908133315577

2.2 再導(dǎo)入導(dǎo) idea 中

會(huì)開始下載 Gradle 構(gòu)建工具 等,會(huì)根據(jù) gradle-wrapper.properties 中的指定版本下載,最好不要修改它的版本

image-20201012092914514

Idea導(dǎo)入 選擇文件夾

image-20200924103331680

選擇使用Gradle

![image-20200924103346932](/Users/johnny/Library/Application Support/typora-user-images/image-20200924103346932.jpg)

靜靜的等待

image-20200908131416428

image-20200908131504088

2.3 排除 "spring-aspects"

排除了 spring-aspects 項(xiàng)目

打開settings.gradle 把 //include "spring-aspects" 注釋了

image-20201012111805740

2.4 下載完依賴后 (耗時(shí)可能要個(gè)15-30分鐘)

可以發(fā)現(xiàn) 依賴都加載完成后,idea 就能識(shí)別我們導(dǎo)入的 spring項(xiàng)目了,并且圖標(biāo)都變亮了

3.引入自定義模塊放入SpringFramework 項(xiàng)目下

下面就是來(lái)驗(yàn)證 我們的 源碼環(huán)境是否 正常, 需要引入一個(gè)自定義的 模塊,并且依賴 core bean 等spring依賴

3.1 新建module

右擊項(xiàng)目 -》 new -》 module 選擇 gradle 項(xiàng)目

3.2 添加 依賴

在新建的module下 打開 build.gradle 引入下面的依賴 spring-beans , spring-context , spring-core , spring-expression

dependencies {
 testCompile group: 'junit', name: 'junit', version: '4.12'

 compile(project(":spring-beans"))
 compile(project(":spring-context"))
 compile(project(":spring-core"))
 compile(project(":spring-expression"))
}

3.3 檢查 module 是否被引入

打開settings.gradle 添加 include 'spring-demo' ,默認(rèn)使用我說(shuō)的創(chuàng)建module 方式 會(huì)自動(dòng)添加的最好檢查一下

3.4 編寫 測(cè)試代碼

3.4.1 定義Person類

package com.johnny.bean;

/**
 * @author johnny
 * @create 2020-09-07 下午11:22
 **/
public class Person {

 private String name;

 private int age;

 @Override
 public String toString() {
 return "Person{" +
 "name='" + name + '\'' +
 ", age=" + age +
 '}';
 }

 public String getName() {
 return name;
 }

 public void setName(String name) {
 this.name = name;
 }

 public int getAge() {
 return age;
 }

 public void setAge(int age) {
 this.age = age;
 }
}

3.4.2 resources 下新建 demo.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"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">


 <bean class="com.johnny.bean.Person" id="person">
 <property name="name" value="johnny"/>
 <property name="age" value="10"/>
 </bean>
</beans>

3.4.3 新建main 加載xml 并且從容器中獲取 bean

package com.johnny.bean;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author johnny
 * @create 2020-09-07 下午11:24
 **/
public class DemoMain {

 public static void main(String[] args) {
 ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("demo.xml");
 Person person = classPathXmlApplicationContext.getBean(Person.class);
 System.out.println(person);
 }
}

可以看到 能獲取到 容器中的Bean ,表示我們的spring環(huán)境搭建正確

image-20201012110602726

總結(jié)

本篇主要講解 如何使用idea 搭建spring源碼環(huán)境,過(guò)程其實(shí)很耗時(shí) 而且特別容易出錯(cuò),總結(jié)就是 1. clone 代碼,2.進(jìn)入源碼目錄執(zhí)行 ./gradlew :spring-oxm:compileTestJava3.導(dǎo)入idea 中 4. 排除 exclude the spring-aspects module 5.自定義module 驗(yàn)證環(huán)境 , 祝愿大家環(huán)境搭建順利。。。最好開個(gè)墻

本文由博客一文多發(fā)平臺(tái) OpenWrite 發(fā)布!

到此這篇關(guān)于Idea 搭建Spring源碼環(huán)境的文章就介紹到這了,更多相關(guān)Idea Spring源碼環(huán)境內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Java Swing JToggleButton開關(guān)按鈕的實(shí)現(xiàn)

    Java Swing JToggleButton開關(guān)按鈕的實(shí)現(xiàn)

    這篇文章主要介紹了Java Swing JToggleButton開關(guān)按鈕的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-12-12
  • Java數(shù)據(jù)結(jié)構(gòu)之紅黑樹的實(shí)現(xiàn)方法和原理詳解

    Java數(shù)據(jù)結(jié)構(gòu)之紅黑樹的實(shí)現(xiàn)方法和原理詳解

    這篇文章主要介紹了Java數(shù)據(jù)結(jié)構(gòu)之紅黑樹的實(shí)現(xiàn)方法和原理,紅黑樹是一種特殊的二叉查找樹,每個(gè)結(jié)點(diǎn)都要儲(chǔ)存位表示結(jié)點(diǎn)的顏色,或紅或黑,本文將通過(guò)示例為大家詳細(xì)講講紅黑樹的原理及實(shí)現(xiàn),感興趣的朋友可以了解一下
    2024-02-02
  • java實(shí)現(xiàn)table添加右鍵點(diǎn)擊事件監(jiān)聽操作示例

    java實(shí)現(xiàn)table添加右鍵點(diǎn)擊事件監(jiān)聽操作示例

    這篇文章主要介紹了java實(shí)現(xiàn)table添加右鍵點(diǎn)擊事件監(jiān)聽操作,結(jié)合實(shí)例形式分析了Java添加及使用事件監(jiān)聽相關(guān)操作技巧,需要的朋友可以參考下
    2018-07-07
  • Java多線程之死鎖的出現(xiàn)和解決方法

    Java多線程之死鎖的出現(xiàn)和解決方法

    本篇文章主要介紹了Java多線程之死鎖的出現(xiàn)和解決方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-10-10
  • 解決@Transaction注解導(dǎo)致動(dòng)態(tài)切換更改數(shù)據(jù)庫(kù)失效問(wèn)題

    解決@Transaction注解導(dǎo)致動(dòng)態(tài)切換更改數(shù)據(jù)庫(kù)失效問(wèn)題

    這篇文章主要介紹了解決@Transaction注解導(dǎo)致動(dòng)態(tài)切換更改數(shù)據(jù)庫(kù)失效問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-09-09
  • Java8如何利用Lambda快速生成map、多層嵌套map

    Java8如何利用Lambda快速生成map、多層嵌套map

    這篇文章主要介紹了Java8如何利用Lambda快速生成map、多層嵌套map問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-09-09
  • Java的靜態(tài)方法Arrays.asList()使用指南

    Java的靜態(tài)方法Arrays.asList()使用指南

    Arrays.asList() 是一個(gè) Java 的靜態(tài)方法,它可以把一個(gè)數(shù)組或者多個(gè)參數(shù)轉(zhuǎn)換成一個(gè) List 集合,這個(gè)方法可以作為數(shù)組和集合之間的橋梁,方便我們使用集合的一些方法和特性,本文將介紹 Arrays.asList() 的語(yǔ)法、應(yīng)用場(chǎng)景、坑點(diǎn)和總結(jié)
    2023-09-09
  • java使用CompletableFuture分批處理任務(wù)實(shí)現(xiàn)

    java使用CompletableFuture分批處理任務(wù)實(shí)現(xiàn)

    本文主要介紹了java使用CompletableFuture分批處理任務(wù)實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2024-07-07
  • PostgreSQL Docker部署+SpringBoot集成方式

    PostgreSQL Docker部署+SpringBoot集成方式

    本文介紹了如何在Docker中部署PostgreSQL和pgadmin,并通過(guò)SpringBoot集成PostgreSQL,主要步驟包括安裝PostgreSQL和pgadmin,配置防火墻,創(chuàng)建數(shù)據(jù)庫(kù)和表,以及在SpringBoot中配置數(shù)據(jù)源和實(shí)體類
    2024-12-12
  • Spring動(dòng)態(tài)多數(shù)據(jù)源配置實(shí)例Demo

    Spring動(dòng)態(tài)多數(shù)據(jù)源配置實(shí)例Demo

    本篇文章主要介紹了Spring動(dòng)態(tài)多數(shù)據(jù)源配置實(shí)例Demo,具有一定的參考價(jià)值,有興趣的可以了解一下。
    2017-01-01

最新評(píng)論

金川县| 盐亭县| 高邮市| 湖南省| 获嘉县| 桃园市| 宣汉县| 视频| 托里县| 盐津县| 饶河县| 凤山县| 辽宁省| 盐源县| 玉树县| 黑山县| 漠河县| 涟水县| 长顺县| 陇川县| 红桥区| 沛县| 东阳市| 深州市| 塔城市| 耿马| 界首市| 象山县| 兰溪市| 凉山| 湟源县| 永年县| 九龙县| 芦山县| 德清县| 临夏县| 加查县| 巴东县| 隆化县| 彰化县| 寿宁县|