IDEA使用SpringAssistant插件創(chuàng)建SpringCloud項(xiàng)目
單擊菜單欄中的 File → Settings → Build, Execution, Deployment → Build Tools → Maven 菜單,在彈出的設(shè)置窗口中設(shè)置 Maven 路徑信息,如下圖:
創(chuàng)建 Spring Cloud(Spring Boot)有兩種方式,這里使用 Spring Assistant 插件創(chuàng)建項(xiàng)目。
(1)啟動(dòng) IDEA,單擊菜單欄中的 File → Settings → plugins 菜單。
(2)進(jìn)入界面,在搜索框中輸入關(guān)鍵字 “Spring Assistant”,然后按 Enter 鍵,會(huì)搜索到 Spring Assistant(Spring 助理)。在 Spring Assistant 的下方點(diǎn)擊 “Install” 按鈕即可完成安裝。如下圖:
(3)重啟 IDEA 后即可使用。
3、創(chuàng)建 Spring Cloud 項(xiàng)目下面以創(chuàng)建 Spring Cloud 項(xiàng)目中的基于 Consul 的“服務(wù)提供者”為例。
(1)打開 IDEA 開發(fā)工具后,選擇菜單:File → New → Project。
在左邊欄中選擇 Spring Assistant,點(diǎn)擊 “Next” 按鈕。
(2)輸入項(xiàng)目相關(guān)信息,點(diǎn)擊 “Next” 按鈕。
(3)創(chuàng)建基于 Consul 的“服務(wù)提供者”,選擇項(xiàng)如下圖,點(diǎn)擊 “Next” 按鈕。
(4)項(xiàng)目創(chuàng)建完成,項(xiàng)目結(jié)構(gòu)圖如下:
打開 pom.xml 文件內(nèi)容如下:
<?xml version='1.0' encoding='UTF-8'?><project xmlns='http://maven.apache.org/POM/4.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd'><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.5.1</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.pjb</groupId><artifactId>provider</artifactId><version>0.0.1-SNAPSHOT</version><name>Provider</name><description>Demo project for Spring Boot</description><properties><java.version>11</java.version><spring-cloud.version>2020.0.3</spring-cloud.version></properties><dependencies> <!-- Spring Cloud Consul 的依賴 --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-consul-discovery</artifactId></dependency> <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>${spring-cloud.version}</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement> <build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build> </project>
從 pom.xml 文件中可以看出,Consul 的依賴已經(jīng)自動(dòng)添加。
以上就是IDEA使用SpringAssistant插件創(chuàng)建SpringCloud項(xiàng)目的詳細(xì)內(nèi)容,更多關(guān)于IDEA創(chuàng)建SpringCloud項(xiàng)目的資料請(qǐng)關(guān)注好吧啦網(wǎng)其它相關(guān)文章!
相關(guān)文章:
1. 詳細(xì)分析css float 屬性以及position:absolute 的區(qū)別2. jsp+servlet簡(jiǎn)單實(shí)現(xiàn)上傳文件功能(保存目錄改進(jìn))3. PHP設(shè)計(jì)模式中工廠模式深入詳解4. 得到XML文檔大小的方法5. ASP基礎(chǔ)知識(shí)Command對(duì)象講解6. PHP循環(huán)與分支知識(shí)點(diǎn)梳理7. xpath簡(jiǎn)介_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理8. ASP實(shí)現(xiàn)加法驗(yàn)證碼9. ASP中格式化時(shí)間短日期補(bǔ)0變兩位長(zhǎng)日期的方法10. ASP刪除img標(biāo)簽的style屬性只保留src的正則函數(shù)
