IDEA使用SpringAssistant插件創(chuàng)建SpringCloud項目
單擊菜單欄中的 File → Settings → Build, Execution, Deployment → Build Tools → Maven 菜單,在彈出的設置窗口中設置 Maven 路徑信息,如下圖:
創(chuàng)建 Spring Cloud(Spring Boot)有兩種方式,這里使用 Spring Assistant 插件創(chuàng)建項目。
(1)啟動 IDEA,單擊菜單欄中的 File → Settings → plugins 菜單。
(2)進入界面,在搜索框中輸入關鍵字 “Spring Assistant”,然后按 Enter 鍵,會搜索到 Spring Assistant(Spring 助理)。在 Spring Assistant 的下方點擊 “Install” 按鈕即可完成安裝。如下圖:
(3)重啟 IDEA 后即可使用。
3、創(chuàng)建 Spring Cloud 項目下面以創(chuàng)建 Spring Cloud 項目中的基于 Consul 的“服務提供者”為例。
(1)打開 IDEA 開發(fā)工具后,選擇菜單:File → New → Project。
在左邊欄中選擇 Spring Assistant,點擊 “Next” 按鈕。
(2)輸入項目相關信息,點擊 “Next” 按鈕。
(3)創(chuàng)建基于 Consul 的“服務提供者”,選擇項如下圖,點擊 “Next” 按鈕。
(4)項目創(chuàng)建完成,項目結構圖如下:
打開 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)容,更多關于IDEA創(chuàng)建SpringCloud項目的資料請關注好吧啦網(wǎng)其它相關文章!
相關文章:
1. Python sorted排序方法如何實現(xiàn)2. windows服務器使用IIS時thinkphp搜索中文無效問題3. ASP.NET MVC實現(xiàn)橫向展示購物車4. Python基于requests實現(xiàn)模擬上傳文件5. python利用opencv實現(xiàn)顏色檢測6. Python文本文件的合并操作方法代碼實例7. Python 中如何使用 virtualenv 管理虛擬環(huán)境8. 通過CSS數(shù)學函數(shù)實現(xiàn)動畫特效9. asp讀取xml文件和記數(shù)10. Python獲取B站粉絲數(shù)的示例代碼
