IDEA使用SpringAssistant插件創(chuàng)建SpringCloud項目
單擊菜單欄中的 File → Settings → Build, Execution, Deployment → Build Tools → Maven 菜單,在彈出的設(shè)置窗口中設(shè)置 Maven 路徑信息,如下圖:
創(chuàng)建 Spring Cloud(Spring Boot)有兩種方式,這里使用 Spring Assistant 插件創(chuàng)建項目。
(1)啟動 IDEA,單擊菜單欄中的 File → Settings → plugins 菜單。
(2)進入界面,在搜索框中輸入關(guān)鍵字 “Spring Assistant”,然后按 Enter 鍵,會搜索到 Spring Assistant(Spring 助理)。在 Spring Assistant 的下方點擊 “Install” 按鈕即可完成安裝。如下圖:
(3)重啟 IDEA 后即可使用。
3、創(chuàng)建 Spring Cloud 項目下面以創(chuàng)建 Spring Cloud 項目中的基于 Consul 的“服務(wù)提供者”為例。
(1)打開 IDEA 開發(fā)工具后,選擇菜單:File → New → Project。
在左邊欄中選擇 Spring Assistant,點擊 “Next” 按鈕。
(2)輸入項目相關(guān)信息,點擊 “Next” 按鈕。
(3)創(chuàng)建基于 Consul 的“服務(wù)提供者”,選擇項如下圖,點擊 “Next” 按鈕。
(4)項目創(chuà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)自動添加。
以上就是IDEA使用SpringAssistant插件創(chuàng)建SpringCloud項目的詳細內(nèi)容,更多關(guān)于IDEA創(chuàng)建SpringCloud項目的資料請關(guān)注好吧啦網(wǎng)其它相關(guān)文章!
相關(guān)文章:
1. python 如何在 Matplotlib 中繪制垂直線2. bootstrap select2 動態(tài)從后臺Ajax動態(tài)獲取數(shù)據(jù)的代碼3. ASP常用日期格式化函數(shù) FormatDate()4. python中@contextmanager實例用法5. html中的form不提交(排除)某些input 原創(chuàng)6. CSS3中Transition屬性詳解以及示例分享7. js select支持手動輸入功能實現(xiàn)代碼8. 如何通過python實現(xiàn)IOU計算代碼實例9. 開發(fā)效率翻倍的Web API使用技巧10. vue使用moment如何將時間戳轉(zhuǎn)為標準日期時間格式
