Spring Cloud 2 Finchley.M9 概覽

18年4月正勒,目前SpringCloud版本為Finchley.M9
1.從表面上看對Eureka腺兴,F(xiàn)eign蔑担,hystrix等項(xiàng)目名稱做了修改牌废,
Edgware.RELEASE
spring-cloud-starter-eureka-server
spring-cloud-starter-eureka
spring-cloud-starter-hystrix
spring-cloud-starter-hystrix-dashboard
spring-cloud-starter-feign

Finchley.M9
spring-cloud-starter-netflix-eureka-server
spring-cloud-starter-netflix-eureka-client
spring-cloud-starter-netflix-hystrix
spring-cloud-starter-netflix-hystrix-dashboard
spring-cloud-starter-openfeign

2.加入了一些新組件,拋棄了一些舊組件
加入Gateway:



加入Reactive Web



加入Reactive Cloud Stream

Quartz Scheduler 任務(wù)調(diào)度

Statemachine 狀態(tài)機(jī)



拋棄Apache Camel 它一個規(guī)則引擎钟沛,可以通過領(lǐng)域語言提供基于規(guī)則的路由引擎畔规,
由于Zuul以及新加入的Gateway的存在,被取締了

拋棄SpringBootAdmin 微服務(wù)監(jiān)控

https://blog.csdn.net/soberchina/article/details/72953994


3.使用Endpoint注解恨统,actuator以及bus的調(diào)用方式做了修改叁扫,以bus為例,源碼有以下改動
Edgware.RELEASE



Finchley.M9



通過上圖可以看到接口的定義方式已經(jīng)發(fā)生改變

This allows us to offer support on Servlet-based apps (Spring MVC and Jersey) as well as reactive apps

@Endpoint注解畜埋,id即接口訪問路徑莫绣。

@ReadOperation可以用GET方式請求 @WriteOperation可以用POST方式請求

SpringCloud默認(rèn)的安全配置不會啟動Endpoint,需要添加一下配置才會啟動

properties:

management.endpoints.web.exposure.include=*

yml:

management:

endpoints:

web:

exposure:

include: '*'

參考:https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-Security-2.0

SpringBoot2.0對用戶定義的endpoint和執(zhí)行器的endpoint不提供分離的自動配置悠鞍,當(dāng)使用了Spring Security对室,自動配置默認(rèn)保護(hù)所有的endpoints。加入了@EnableWebSecurity注解和基于Spring Security的內(nèi)容協(xié)商策略的信任咖祭,來決定用httpBasic還是formLogin掩宜。加入了一個有默認(rèn)用戶名和密碼的用戶,它可以用來登錄么翰。

4.配置參數(shù)修改

4.1 management.security.enabled=false配置過時(shí)牺汤,

4.2 SpringCloud提供了默認(rèn)的安全配置,如果使用自定義安全控制浩嫌,默認(rèn)配置會失效

自定義Endpoint安全控制

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-security</artifactId>

</dependency>

4.3 繼承WebSecurityConfigurerAdapter

import org.springframework.boot.actuate.autoconfigure.security.servlet.EndpointRequest;

import org.springframework.boot.autoconfigure.security.servlet.PathRequest;

import org.springframework.context.annotation.Configuration;

import org.springframework.core.annotation.Order;

import org.springframework.security.config.annotation.web.builders.HttpSecurity;

import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration

@Order(1)

public class ActuatorWebSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter {

@Override

protected void configure(HttpSecurity http) throws Exception {

http

.authorizeRequests()

.requestMatchers(EndpointRequest.to("env")).permitAll()

.requestMatchers(EndpointRequest.toAnyEndpoint()).hasRole("ACTUATOR")

.requestMatchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()

.antMatchers("/**").hasRole("USER")

.and()

.httpBasic();

}

}

參考資料

Springboot2

https://spring.io/blog/2017/09/15/security-changes-in-spring-boot-2-0-m4

https://spring.io/blog/2017/08/22/introducing-actuator-endpoints-in-spring-boot-2-0

Actuator相關(guān)

https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html

https://www.infoq.com/news/2017/08/spring-boot-2-actuator-endpoints

https://github.com/spring-projects/spring-boot/wiki/Migrating-a-custom-Actuator-endpoint-to-Spring-Boot-2

Eureka Clients

https://cloud.spring.io/spring-cloud-netflix/multi/multi__service_discovery_eureka_clients.html

Endpoints

https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html

content negotiation

https://blog.csdn.net/u012410733/article/details/78536656

Reactive Web Applications

https://docs.spring.io/spring/docs/5.0.0.M4/spring-framework-reference/html/web-reactive.html

https://spring.io/blog/2016/06/07/notes-on-reactive-programming-part-i-the-reactive-landscape

事件驅(qū)動和消息驅(qū)動

http://www.cnblogs.com/welen/articles/5115213.html

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末檐迟,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子码耐,更是在濱河造成了極大的恐慌追迟,老刑警劉巖,帶你破解...
    沈念sama閱讀 216,544評論 6 501
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件骚腥,死亡現(xiàn)場離奇詭異敦间,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)桦沉,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,430評論 3 392
  • 文/潘曉璐 我一進(jìn)店門每瞒,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人纯露,你說我怎么就攤上這事剿骨。” “怎么了埠褪?”我有些...
    開封第一講書人閱讀 162,764評論 0 353
  • 文/不壞的土叔 我叫張陵浓利,是天一觀的道長挤庇。 經(jīng)常有香客問我,道長贷掖,這世上最難降的妖魔是什么嫡秕? 我笑而不...
    開封第一講書人閱讀 58,193評論 1 292
  • 正文 為了忘掉前任,我火速辦了婚禮苹威,結(jié)果婚禮上昆咽,老公的妹妹穿的比我還像新娘。我一直安慰自己牙甫,他們只是感情好掷酗,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,216評論 6 388
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著窟哺,像睡著了一般泻轰。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上且轨,一...
    開封第一講書人閱讀 51,182評論 1 299
  • 那天浮声,我揣著相機(jī)與錄音,去河邊找鬼旋奢。 笑死泳挥,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的至朗。 我是一名探鬼主播羡洁,決...
    沈念sama閱讀 40,063評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼爽丹!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起辛蚊,我...
    開封第一講書人閱讀 38,917評論 0 274
  • 序言:老撾萬榮一對情侶失蹤粤蝎,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后袋马,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體初澎,經(jīng)...
    沈念sama閱讀 45,329評論 1 310
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,543評論 2 332
  • 正文 我和宋清朗相戀三年虑凛,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了碑宴。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 39,722評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡桑谍,死狀恐怖延柠,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情锣披,我是刑警寧澤贞间,帶...
    沈念sama閱讀 35,425評論 5 343
  • 正文 年R本政府宣布贿条,位于F島的核電站,受9級特大地震影響增热,放射性物質(zhì)發(fā)生泄漏整以。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,019評論 3 326
  • 文/蒙蒙 一峻仇、第九天 我趴在偏房一處隱蔽的房頂上張望公黑。 院中可真熱鬧,春花似錦摄咆、人聲如沸凡蚜。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,671評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽番刊。三九已至,卻和暖如春影锈,著一層夾襖步出監(jiān)牢的瞬間芹务,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,825評論 1 269
  • 我被黑心中介騙來泰國打工鸭廷, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留枣抱,地道東北人。 一個月前我還...
    沈念sama閱讀 47,729評論 2 368
  • 正文 我出身青樓辆床,卻偏偏與公主長得像佳晶,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子讼载,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,614評論 2 353