编程知识 cdmana.com

Spring cloud 2020.0.0 officially released, goodbye to Netflix

[TOC]![](https://img-blog.csdnimg.cn/20201223221110542.png#pic_center)> Share 、 Grow up , Refuse to hide . Follow public account 【**BAT The Utopia of **】, Reply key ` Column ` Yes Spring Technology stack 、 Intermediary software and other small and beautiful ** Original column ** For free study . This article has been [https://www.yourbatman.cn](https://www.yourbatman.cn) Included .# Foreword hello , I am a YourBatman. Beijing time 2020-12-22 Late at night ,`Spring Cloud 2020.0.0` The version is officially released .2020.0.0 It's the first one to use the new version Spring Cloud Release . As for the version number, here is a few words : Before that ,Spring Cloud Of Release Train The name is the London underground station , Such as :Hoxton、Greenwich etc. .> Explain :2020.0.0 Version is also known as `Ilford`( Name of subway station ), Because of this project 3 It was only a month later that it changed its name according to the new rules , I guess it's for the convenience of communication within the team , You can also understand that it is just an internal code , Easy to communicate, though in alphabetical order , But there are still two fatal problems :- Yes, English ** Mother tongue ** State ( Like the Chinese dynasty ) Very unfriendly , Unable to quickly sort out the version number relationship - A-Z, If the version number goes to Z What about it ? How to continue to develop ? Your products , You're fine ![](https://img-blog.csdnimg.cn/20201223185627672.png#pic_center)Spring Realizing that it's a problem for the team , So this year 3 The month made ** Change **. For details, please refer to an article I wrote earlier (** It is strongly recommended that ** Everyone who comes in knows about this rule change ):[Spring Change the naming rules of version number : This is very friendly to non English speaking countries ](https://mp.weixin.qq.com/s/ZoUG9h1TndW2QpnPyGeIQA)> Explain : Version number rule changes apply to all Spring Technology stack , contain Spring Framework、Spring Boot、Spring Cloud、Spring Data... Wen guizheng Zhuan .Spring Cloud As early as the beginning of the year started the development of this version , And this year 4 It was released in January 2020.0.0-M1 edition ( The first milestone version ), Until you leave 2020 The year is not over 10 It's been a long time “ Suffocate ” Big recruit , formal RELEASE.Spring Cloud As built on Spring Boot The cloud computing framework above , I think there are two main reasons for this dystocia :1. Spring Boot 2.4.0 edition 2020-11-12 It's only formal RELEASE(Spirng Framework 5.3.0 edition 2020-10-27 only RELEASE) 1. [Spring Framework 5.3.0 Officially release , Continue to make efforts on the road of Yunyuan ](https://mp.weixin.qq.com/s/Sw6EqAY0DmF-p2qPoaetUg) 2. [Spring Boot 2.4.0 Officially release , New configuration file loading mechanism ( No downward compatibility )](https://mp.weixin.qq.com/s/KywpJkLDHZbZTxUf4WFxhw)2. The changes are really too big , Research and development 、 Test 、 It's all about a huge amount of paperwork Spring Framework、Spring Boot、Spring Cloud The release circuit diagram of the three verified my words once again :** You are right about Spring Cloud More knowledge comes from your knowledge of Spring Boot How much do you know about , You are right about Spring Boot More knowledge comes from your knowledge of Spring Framework How much do you know about **. That's why I spend a lot of time on Spring Framework Up, not Spring Boot The root cause is , The bottom layer is transparent , It's easy to use on the top .![](https://img-blog.csdnimg.cn/20201223213749175.png#pic_center)## Version Convention - Spring Framework:5.3.2- Spring Boot:2.4.1- Spring Cloud:2020.0.0 - The above version is SC“ Carry ” Version of ![](https://img-blog.csdnimg.cn/2020122406543886.png#pic_center)# There is an interesting phenomenon in the text , Before the deadline (2020-12-23 22:00:00)** Official website ** The latest version has not been marked as 2020.0.0 edition ( As shown in the picture ):![](https://img-blog.csdnimg.cn/20201223214028434.png#pic_center) In fact, as early as 24h Before the official blog made a release announcement :![](https://img-blog.csdnimg.cn/20201223214714540.png#pic_center) And Maven The central warehouse also has the latest Jar package ( Prove that you're normal 、 There's no problem using it ):![](https://img-blog.csdnimg.cn/2020122321485778.png#pic_center) In fact , The document level is not limited to the official website sync The latest version , I'm not going to list them all , After all, it's not very important . In view of this phenomenon, I yy once , Is it right? Spring Cloud There's a shortage of people in the team ? May I ask if there is any social recruitment ?O(∩_∩)O ha-ha ~## Spring Cloud Version management version management is too important for software development , stay Spring Boot Prior to the emergence of dependencies 、 Version management is really big ( Even if there is Spring BOM There is ), Especially when there's a version ** It doesn't fit ** It's easy to steal an afternoon or even a whole day .Spring Cloud As the upper application framework , Only when the underlying version matches can it work properly work, One of the most important is with Spring Boot The version number should be aligned with .### And Spring Boot Version correspondence Spring Boot The emergence and popularity of the Internet has greatly alleviated the above situation , But use it Spring Cloud When it comes to Spring Boot Version correspondence is still needed ** Pay special attention to ** Of . So I've summed up this form for you :Release Train | Release time | Spring Boot edition | SC Commons edition -------- | ----- | ----- | -----**2020.0.x** | **2020-12** | **2.4.x** | **3.0.0**Hoxton | 2019-07 | 2.2.x, 2.3.x ( From SR5 rise ) | 2.2.xGreenwich | 2018-11 | 2.1.x | 2.1.xFinchley | 2017-10 | **2.0.x** | 2.0.xEdgware | 2017-08 | 1.5.x | 1.3.xDalston | 2017-05 | 1.5.x | 1.2.xBrixton | 2016-09 | 1.3.x | 1.1.xAngel | 2016-05 | 1.2.x | 1.0.x> Explain : For Spring Cloud Internal components 、Spring Boot、Spirng Framework、Security And so on this huge system version contrast relations , The article has been sorted out , The next chapter sends out , Please remember to search for it :`spring-cloud-starter-loadbalancer` Is accompanied by Spring Cloud Commons 2.2.0 It's a commercial version (Hoxton edition ), Please pay a little attention to this version node , Because it replaces Ribbon.### Currently supported versions Spring Cloud follow **Pivotal OSS support policy** The agreement is right ** Major version ** Provide 3 The support of . Besides , stay Spring Cloud After the major or minor version of is released , If there is serious bug And security issues , It will be maintained for another period of time (6-12 Not for months ).> Pay special attention to : This means ** Major version ** It's just 3 year , Major versions don't happen very often. Now 2020.0.0 Version released , It's time for elimination again . Now Spring Cloud The official versions that will be supported are :- **2020.0 edition **:( Support Spring Boot 2.4.x) It is ** Major version **, According to the plan, it will support 2023 year 12 month - It's from Finchley Another major version after - **Hoxton edition **:( Support Spring Boot 2.2.x and 2.3.x) As Finchley A minor version of the release series , Its routine maintenance will continue until 2021 year 6 End of month . From 2020-07 Start to enter the special maintenance period ( No new features , Just change the urgency bug),2021-12 At the end of the month, there will only be major mistakes / Security patch - **Greenwich edition **:( Support Spring Boot 2.1.x)2020-01 It stopped maintenance ,2020-12-31 It will also end its special maintenance period - **Finchley edition **:( Support Spring Boot 2.0.x) It's a ** Major version ** The beginning of ,2018 Released in - ** The older version **: Um. , Forget it ![](https://img-blog.csdnimg.cn/20201223233224440.png#pic_center)Spring official ** Suggest **: Try to use the latest version . But suggestions are suggestions , As for using only ** Late mass ** We of Technology , Only when you sit in the second or even the third row can you feel secure . But the waves of history will eventually eliminate the front row , So it's always good to get ready early , Not until they are pushed to the front row ** Swimming naked **.Spring Cloud 2020.0 As a ** Major version **, There have been many remarkable changes , There are some blocking updates ( No downward compatibility ) Is the biggest point of this article , Come on, serve .## Blocking upgrade ( No downward compatibility ) Almost last year (2019 year ) At this time of the year ,Spring Cloud In its Roadmap( It has been introduced in the previous article ) They announced that they would ** End ** Some libraries of / edition , The most important one is **Spring Cloud Netflix Project enters maintenance mode **, And then plan on 2020 It was completely removed in .Spring Cloud Making such a decision is also “ Forced ”. We know Spring Cloud All the time `Netflix OSS` Suite as its official default one-stop solution , At that time Netflix OSS I wish I could be with Spring Cloud Make an equal sign . What's the matter ,Netflix The company in 2018 Its core components were announced around 2000 Hystrix、Ribbon、Zuul、Archaius Wait for all to enter ** Maintenance status **.> Although there is Zuul 2.x,Archaius 2.x, But they are not compatible downward , Can't smooth upgrade , So it's almost impossible to use from 2018 Up to now, the modules in maintenance state are ( Including its corresponding starter, Not listed here ):1. spring-cloud-netflix-archaius2. spring-cloud-netflix-hystrix-contract3. spring-cloud-netflix-hystrix-dashboard4. spring-cloud-netflix-hystrix-stream5. spring-cloud-netflix-hystrix6. spring-cloud-netflix-ribbon7. spring-cloud-netflix-turbine-stream8. spring-cloud-netflix-turbine9. spring-cloud-netflix-zuul### 1、 Goodbye ,Netflix To this day ,Spring Cloud 2020.0 Officially release , In this major version , According to the plan, we finally got to know `spring-cloud-netflix` It's a knife . I drew a picture for you `spring-cloud-netflix-dependencies` Of xml A comparison of the main differences between the two versions of the archives , At a glance :![](https://img-blog.csdnimg.cn/2020122400165972.png#pic_center)- `spring-cloud-netflix-dependencies` It doesn't disappear , It still exists , The version number is upgraded to 3.0.x edition - The old version of `spring-cloud-netflix-dependencies` Managed by Netflix All components , Include Hystrix、Ribbon、Zuul、Eureka etc. . And since 2020.0 Since version ,** It has and only manages Eureka( Include Server and Client)**> Explanation :Feign Although it originally belonged to Netflix company , But from 9.x The version is handed over to OpenFeign Organized and managed , Therefore, it is no longer included in Netflix The scope of jurisdiction can be summed up in one sentence :Spring Cloud 2020.0.0 edition ** Delete... Completely ** It fell off Netflix except Eureka External ** all ** Components . thus , We can be grateful for Netflix OSS Thank you , And can say goodbye to it .![](https://img-blog.csdnimg.cn/20201224000042869.png#pic_center)> Explain :Netflix Of Eureka The project is still active , The design of this registration center is excellent , The overall performance is fair , The competitiveness in the market is still remarkable , therefore Spring Cloud I haven't given it up yet ```xml org.springframework.cloud spring-cloud-starter-netflix-eureka-client ```#### Netflix Component alternatives Spring Cloud Since you put Netflix OSS The kit was slashed , There must be an alternative . That's inevitable ,Spring Cloud The team recommended to us the alternative product :Netflix | Recommend alternatives | Explain -------- | ----- | -----Hystrix | Resilience4j | Hystrix I also recommend that you use it instead of yourself Hystrix Dashboard / Turbine | Micrometer + Monitoring System | To put it bluntly , It's up to more professional components to monitor this Ribbon | Spring Cloud Loadbalancer | I can't help it ,Spring I'll do it myself Zuul 1 | Spring Cloud Gateway | I can't help it ,Spring I'll do it myself Archaius 1 | Spring Boot Externalized configuration + Spring Cloud To configure | Than Netflix To achieve better 、 More powerful ##### Spring Cloud LoadBalancer What is it ? Among the above alternatives , You may be the stranger 、 What I'm most curious about is `Spring Cloud Loadbalancer`, It was just Spring Cloud ** The incubator ** A small project in , And once stranded . And then restart it , Development , The present makes its great mission , Officially used for ** Completely replace ** Ribbon, Become Spring Cloud Load balancer ** The only way to achieve **. It is worth noting that :Spring Cloud LoadBalancer It was first introduced in Spring Cloud Commons 2.2.0 When , That is to say Hoxton When it is released, it introduces , It's just that it's just a spare tire / Alternative , The presupposition is still Ribbon Pick the beam . The next screenshot is in Hoxton The situation of the version :![](https://img-blog.csdnimg.cn/20201224004316321.png#pic_center) As shown in the picture , Load balancing abstraction `LoadBalancerClient` The interface has two implementations , And by the Spring Cloud 2020.0 After the version ,`BlockingLoadBalancerClient` It's the only way to achieve .> About spring-cloud-loadbalancer The use of load balancers , There's an extremely recommended course for the government :https://spring.io/guides/gs/spring-cloud-loadbalancer. If you are interested, you can play by yourself , If you're not interested , Let's focus on the analysis of my later articles , I'll introduce it specially #### Spring Cloud Alibaba Can it be used as an alternative ? Um. , It's fine too . But for now it's not Spring Cloud Official recommended default scheme . We look forward to working together , We can deliver as soon as possible Spring Cloud Alibaba Up , Let the crooked nuts use the frame of our Chinese dynasty , carry issue It has to be in Chinese O(∩_∩)O ha-ha ~.#### Show import Netflix Is the bag still normal work? I want to upgrade to the latest version of Spring Cloud, And want to keep it down compatible Netflix The technology of . Although spring-cloud-netflix-dependencies It no longer contains netflix The core components of , Can I manually guide the package and specify the version number ? Is it normal work Well ?** answer **: I'll give you an answer ,** no way **. Since I haven't demonstrated , But it's freaky to use it like this , The plan should be shot in the bud , There shouldn't be . in addition , This also tells us that : Use Spring Cloud Try to face it ** abstract ** Programming , So even if Spirng Cloud Replace the underlying components ( If the fuse is replaced 、 Load balancer ) wait , Theoretically, it has no or little impact on our business , It's all thanks to its Spring Cloud Commons abstract , That's the essence .### 2、Bootstrap Context presupposition no longer activates the students who know the principle to know ,Spring Cloud The container depends on `Bootstrap Context` Guide the context to start , The corresponding class is `BootstrapApplicationListener`. This is in the 2020.0 The version has changed ,** The new version of the Spring Cloud No longer depends on this context to start **. So by default , Will no longer start Bootstrap Context . Code level changes happen here :```javaBootstrapApplicationListener: @Override public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { ConfigurableEnvironment environment = event.getEnvironment(); // This judgment is added at the beginning of the method if (!bootstrapEnabled(environment) && !useLegacyProcessing(environment)) { return; } ... }PropertyUtils: // BOOTSTRAP_ENABLED_PROPERTY = spring.cloud.bootstrap.enabled public static boolean bootstrapEnabled(Environment environment) { return environment.getProperty(BOOTSTRAP_ENABLED_PROPERTY, Boolean.class, false) || MARKER_CLASS_EXISTS; } // USE_LEGACY_PROCESSING_PROPERTY = spring.config.use-legacy-processing public static boolean useLegacyProcessing(Environment environment) { return environment.getProperty(USE_LEGACY_PROCESSING_PROPERTY, Boolean.class, false); }```#### Open mode if you need to open Bootstrap Context , There are two ways to achieve :1. Set value `spring.cloud.bootstrap.enabled=true` perhaps `spring.config.use-legacy-processing=true` that will do . Be careful : These attribute values must be ensured that they can be put into the environment in order to take effect . For example, the reliable way is : System properties 、 Environmental variables 、 Command line, etc 2. Introduce a Jar:`org.springframework.cloud:spring-cloud-starter-bootstrap`, And then you don't have to do anything 1. Explain : This jar There is and only one `Marker` Class , The effect you know , I won't explain too much here > Explain : Open manually Bootstrap Context , Prove you fallback Load in the old way SC, Then please do everything in the old way ### 3、 The new configuration method benefits from Spring Boot 2.4.x Support new configuration file writing mode , From then on, you can use `spring.config.import` Both import the configuration of the other build . Such as :- spring.config.import=configserver:xxx- spring.config.import=zookeeper:- ... This is more modular , More in line with the requirements of cloud native environment .### 4、 Other - To disable Spring Cloud Config Client The health indicator on the end uses `health.config.enabled=false`, Now it is changed to `management.health.config.enabled=false`. Keep up with Spring Boot Control endpoint style is consistent - With invalid characters ( Dashes ) The endpoint of id It has been changed to conform to the standard , Since then, there have been no annoying warnings at the start-up , Save the Puritans . - bus-env -> busenv - bus-refresh -> busrefresh - service-registry -> serviceregistry```java// old@Endpoint(id = "service-registry")public class ServiceRegistryEndpoint { ... }// new@Endpoint(id = "serviceregistry")public class ServiceRegistryEndpoint { ... }```## Regular upgrade conventional upgrade this focus is not so much , Mainly for its components such as `Spring Cloud Commons、Spring Cloud Kubernetes、Spring Cloud Openfeign...` Do some regular upgrades , There is nothing to be said about it . There's a point to pay attention to :Spirng Cloud be-all Module Version numbers have been upgraded to `3.0.0`( Upgrade of large version number ), except Spring Cloud Circuitbreaker/Spring Cloud Kubernetes(2.0.0) and Spring Cloud Task(2.3.0) outside .## There are still problems though 2020.0 Already RELEASE 了 , But there are still unsolved problems , Give a few examples of this version ** Existing ** The problem of :- If you use `spring.config.import=configserver:` To configure the configuration center , This version is missing support retry Arguments - Solutions : If you want to use it , You have to fallback It's the traditional way ( Written in bootstrap.yaml Li )- `spring-cloud-config-dependencies` There is a non release Version of jar( Take a look at the screenshot ) - Solutions : Manually specify the jar Version number of ![](https://img-blog.csdnimg.cn/20201224012523158.png#pic_center)> Explain :M1 It's a milestone version , It also belongs to the early stage of getting up , Possible bug, It is recommended that you manually specify the version number to replace this jar It seems that even better than Spring Team , There will be all kinds of mistakes . If you think about it , I dare to go back and write again bug Let's go .# Summary Spring Cloud 2020.0.0 yes Spring Cloud Of ** Major version **, It's a very important existence , Upgrade 、 The change is also huge . It is especially reflected in Netflix Removal of all modules 、Spring Cloud The startup mode has changed and so on . Accompanied by Spring Boot 2.4.x as well as Spirng Cloud 2020.0 The release of , And discard Netflix OSS After the kit , It's bound to move into a new ** Deep programming ** Experience , Full of surprises , I'm looking forward to .> Explain : Because this version completely discards Netflix A set of things , To keep up with the times , I'll use it for a while and then , Write the latest version of the series as soon as possible , It is mentioned at the end of the article that 2020.0 The version has been released , But there are still some problems . But then again , Those are small problems , It may be fixed in the next small version . But the embarrassment is , Distance 2020 The end of the year is less than 10 days , If you enter 2021 year , Name the new rules according to the version number , The version issued at that time will no longer be called 2020.x.x And can only be 2021.x.x, Obviously, this is an iteration of a large version number , You need to be careful .** You think Spring Cloud Team in 2020 Will it be released in the year of ? Welcome to leave your comments in the comments section .**---### Recommended reading 【Spring Type conversion 】 series :- [1. Uncover the secret Spring Type conversion - The cornerstone of frame design ](https://mp.weixin.qq.com/s/5daOOdhIFqrGbpgtnuQMNw)- [2. Spring Early type conversions , Based on PropertyEditor Realize ](https://mp.weixin.qq.com/s/Afu8YYyREoynAXS6YrJe7g)- [3. Fix up the work ,PropertyEditor That's it ](https://mp.weixin.qq.com/s/--UO3pH1nxTW3f5nQvEnkg)- [4. On the new Spring, A new generation of type conversion mechanism ](https://mp.weixin.qq.com/s/SMKs3fYoJm1Dfpy-6m_9ZQ)- [5. Through the crowd ,Spring We've made a high-level track for you ](https://mp.weixin.qq.com/s/wnuqbgnS-D-U48XrxHKIvg)- [6. To smooth out the difference , Unified type conversion service ConversionService](https://mp.weixin.qq.com/s/9MPkCSM9AbsgKAFQ1eXBNQ)【Jackson】 series :- [1. First acquaintance Jackson -- The best in the world JSON Ku ](https://mp.weixin.qq.com/s/iqSN4HUoIdX0kGcSdnD7EA)- [2. Mommy ,Jackson It was written like this JSON Of ](https://mp.weixin.qq.com/s/p6cwP2BVrC8VxkN-T3uAxg)- [3. Understand this , Fang dares to say that he can use Jackson Write JSON](https://mp.weixin.qq.com/s/ZHb3P06IC4xElHwJqDepxw)- [4. JSON How the string is parsed ?JsonParser Get to know ](https://mp.weixin.qq.com/s/syAOETfEawiGItaQO35mLA)- [5. JsonFactory It's just a factory , It's quite interesting , This is what I didn't expect ](https://mp.weixin.qq.com/s/0ZaDYb_ueFLbvOf3FbetfQ)- [6. Twenty not confused ,ObjectMapper Use is no longer confusing ](https://mp.weixin.qq.com/s/VYy1QVeFLRkciymFHueb5w)- [7. Jackson Treat with a tree model JSON It's a necessary skill , Don't believe it. ](https://mp.weixin.qq.com/s/hPRdt-6sHt4rZaW2_jhdWQ)【 Data verification Bean Validation】 series :- [1. No blowing, no beating , The first one will improve your understanding of Bean Validation The cognition of data validation ](https://mp.weixin.qq.com/s/g04HMhrjbvbPn1Mb9JYa5g)- [2. Bean Validation Arguments to declarative verification methods 、 Return value ](https://mp.weixin.qq.com/s/-KeOCq2rsXCvrqD8HYHSpQ)- [3. On the use level ,Bean Validation You need to be familiar with these standard interfaces ](https://mp.weixin.qq.com/s/MQjXG0cg8domRtwf3ArvHw)- [4. Validator Five core components of calibrator , There can be no less ](https://mp.weixin.qq.com/s/jzOv67ZTSx2rByj0aeUTgw)- [5. Bean Validation Four levels of declarative verification : Hurdles 、 Properties 、 Container elements 、 Class ](https://mp.weixin.qq.com/s/6_7gZ9jmQcDSRiARO6D-yw)- [6. Custom container type element validation , Class level validation ( Multi field joint validation )](https://mp.weixin.qq.com/s/MN-_JCGnsEWpPJs9xQ_qZA)【 New characteristics 】 series :- [IntelliJ IDEA 2020.3 Officially release , The last version of the year is very martial arts ](https://mp.weixin.qq.com/s/vNnfKEGRm7R3PN_lCtXJDA)- [IntelliJ IDEA 2020.2 Officially release , Many bright spots, there are always a few can help you improve the effect ](https://mp.weixin.qq.com/s/8voJSbmcBbdfNUCUBIcKcA)- [IntelliJ IDEA 2020.1 Officially release , What you want Almost It's all here !]()- [Spring Framework 5.3.0 Officially release , Continue to make efforts on the road of Yunyuan ](https://mp.weixin.qq.com/s/Sw6EqAY0DmF-p2qPoaetUg)- [Spring Boot 2.4.0 Officially release , New configuration file loading mechanism ( No downward compatibility )](https://mp.weixin.qq.com/s/KywpJkLDHZbZTxUf4WFxhw)- [Spring Change the naming rules of version number : This is very friendly to non English speaking countries ](https://mp.weixin.qq.com/s/ZoUG9h1TndW2QpnPyGeIQA)- [JDK15 Officially release , Epoch making ZGC At the same time, he announced that he would become a full-time official ](https://mp.weixin.qq.com/s/3QaiUGzj5nW2N4Aipm47PQ)【 Programmed life 】 series :- [ Ant financial is on the market , I don't want to try ](https://mp.weixin.qq.com/s/oEShE0fiHSGG8D89NRQYGw)- [ If both programmers and product managers talk in Versailles Literature ......](https://mp.weixin.qq.com/s/SZUJ0sy4vM7UH10pk6NM3g)- [ Programmed life | Happy horse's hoof disease , See all the flowers of Chang'an in one day ](https://mp.weixin.qq.com/s/PGIFtpI7aZaxY7es0F6C6Q) And things like 【Spring Configuration class 】【Spring-static】【Spring Data binding 】【Spring Cloud Netflix】【Feign】【Ribbon】【Hystrix】... More original Columns , Concern `BAT The Utopia of ` Reply ` Column ` You can get it all in two words , You can also add me `fsx1056342982`, Make a friend .> There are some ** It's over **, There are some ** In the serial **. I am a A Brother (YourBatman), I'll see you next time

版权声明
本文为[itread01]所创,转载请带上原文链接,感谢
https://cdmana.com/2020/12/20201224152743228E.html

Scroll to Top