spring boot和spring cloud 開發必備工具准備 和 必備網站導航


spring boot和spring cloud 開發必備工具准備 和 必備網站導航

本文主要介紹spring cloud開發前期准備,為以后學習和開發有一些資料保障: 
常用網站:

  1. spring boot 官網英文網站,有一些簡單和詳細的介紹 http://projects.spring.io/spring-boot/

  2. spring cloud 官方英文網站 http://projects.spring.io/spring-cloud/

  3. spring cloud 中國社區 http://bbs.springcloud.cn/

  4. spring cloud 中文網 有翻譯不全中文文檔 https://springcloud.cc/

  5. spring boot maven gradle 配置 一鍵生產並下載 http://start.spring.io/

  6. Netflix網飛公司github 包含 eureka和zuul 等相關工程, 
    並且有相關文檔和各類問題解決 https://github.com/Netflix/eureka

  7. 51CTO有目前最新的spring cloud微服務實戰課程的主要就是講springcloud基本組件講解。

  8. 2017年5月份剛出的一本spring cloud的書可以某東 某寶有賣。

  9. spring cloud 英文文檔 http://cloud.spring.io/spring-cloud-static/Camden.SR3/

這里寫圖片描述

spring cloud 是基於spring boot微服務架構設計開發的。主要還是針對spring boot開調整開發工具。

  1. 首先spring cloud項目是依賴JDK1.8,這個需要自行安裝即可。

2、然后可以下載新版的eclipse進行安裝,本人安裝的最新 eclispe neon2 需要jdk8啟動,也可以用其他版本,感覺新版的對spring boot支持比較好 
http://www.eclipse.org/downloads/eclipse-packages/

3、安裝相應項目構建插件maven或者gradle,建議安裝較新版本的。

4、在 eclipse 安裝相應插件,主要要安裝spring suit tool 和 maven 插件, 如果用gradle開發則安裝gradle插件,如果有失敗安裝過程可能需要多安裝那么一兩次就能成功了。 
下面的具體插件截圖:

這里寫圖片描述

這里寫圖片描述 
這里寫圖片描述

這里寫圖片描述

這里寫圖片描述

這里寫圖片描述

本人使用的是maven工具進行項目構建: 
相關的setting.xml如下:建議使用第三方maven庫,比如阿里的庫速度就挺快的,不然拉去jar包和一些xml約束在沒有網絡代理將是一個糾結過程。

<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository>D:/maven-repository</localRepository> <pluginGroups> <pluginGroup>org.mortbay.jetty</pluginGroup> </pluginGroups> <proxies> </proxies> <servers> <server> <id>releases</id> <username>ali</username> <password>ali</password> </server> <server> <id>Snapshots</id> <username>ali</username> <password>ali</password> </server> </servers> <mirrors> <mirror> <!--This sends everything else to /public --> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> </mirror> <mirror> <!--This is used to direct the public snapshots repo in the profile below over to a different nexus group --> <id>nexus-public-snapshots</id> <mirrorOf>public-snapshots</mirrorOf> <url>http://maven.aliyun.com/nexus/content/repositories/snapshots/</url> </mirror> </mirrors> <profiles> <profile> <id>development</id> <repositories> <repository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases> <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases> <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots> </pluginRepository> </pluginRepositories> </profile> <profile> <!--this profile will allow snapshots to be searched when activated--> <id>public-snapshots</id> <repositories> <repository> <id>public-snapshots</id> <url>http://public-snapshots</url> <releases><enabled>false</enabled></releases> <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>public-snapshots</id> <url>http://public-snapshots</url> <releases><enabled>false</enabled></releases> <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>development</activeProfile> <activeProfile>public-snapshots</activeProfile> </activeProfiles> </settings>

由於選擇新版本的eclipse是自帶maven插件和marketPlace很方便。選擇新版本原因主要也是用來進行spring cloud 項目開發。

上述工作做好后,就可以看到導入外部maven工程后可以讓項目在run as 有spring boot App啟動不必去到切換main主類中進行啟動。而且添加的spring boot支持可以使用application.yml作為主要配置文件取代application.properties 使用配置具體結構化的提示,填寫非常簡單。

對於spring boot項目的依賴可以查看pom文件中的選項,避免一些導入一些不必要的jar包,或者有沖突的jar包。 
如下圖: 
這里寫圖片描述


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM