Share, grow, refuse to hide. Pay attention to the public number [BAT utopia], reply to the keyword column has Spring technology stack, middleware and other small and beautiful original column for free learning. This article has been included in www.yourbatman.cn.

The foreword ✍

Hi, I’m YourBatman.

Spring Cloud version 2020.0.0 has been released. 2020.0.0 is the first Spring Cloud release to use the new version scheme.

A few words about the version number: Before this, the name of the Release Train of Spring Cloud adopted the naming method of London underground station, such as Hoxton and Greenwich.

Note: version 2020.0.0 is also called Ilford (subway station name), because this project was renamed after 3 months in accordance with the new rules, I guess it is for the convenience of communication within the team, you can also understand that it is only an internal code, convenient communication

In alphabetical order, two fatal problems remain:

  • Very unfriendly to non-English speaking countries (such as China), unable to quickly sort out version numbers
  • A-z, what if version number goes to Z? How to continue to develop? You taste, you fine taste

The Spring team realized this was a problem and made a change in March of this year. For details, refer to my previous post (and I strongly recommend that everyone who comes in be aware of this rule change) : Spring changes the naming rules for version numbers: this is a friendly move for non-English speaking countries

Note: Version number rule changes apply to all Spring technology stacks, including Spring Framework, Spring Boot, Spring Cloud, Spring Data…

Back to business. Spring Cloud has been working on this version since the beginning of the year, and released its 2020.0.0-M1 version (the first milestone RELEASE) in April of this year, with less than 10 days to go until 2020.

Spring Cloud is a Cloud computing framework built on Spring Boot. I think there are two main reasons for this difficult delivery:

  1. SPRNG Framework 5.3.0 2020-10-27 SPRNG Framework 5.3.0 2020-10-27
    1. Spring Framework 5.3.0 has been officially released, continuing its efforts on the cloud native road
    2. New configuration file loading mechanism (not backward compatible)
  2. It was a huge amount of change, and the amount of research, testing, and documentation was huge

From Spring Framework, Spring Boot, Spring Cloud three release circuit diagram again verify my statement: How much you know about Spring Cloud comes from how much you know about Spring Boot, and how much you know about Spring Framework. This is the fundamental reason why I spent a lot of time on the Spring Framework rather than Spring Boot.

Version of the agreement

  • Spring Framework: 5.3.2
  • Spring the Boot: against 2.4.1
  • Spring Cloud: 2020.0.0
    • The preceding versions are SC “carried” versions

✍ body

There is an interesting phenomenon, as of the press (2020-12-23 22:00:00) official website has not been synchronized with the latest version of 2020.0.0 (as shown in the picture) :

In fact, as early as 24 hours ago, the official blog made the announcement:

The Maven central repository already has the latest Jar package (proof that you can use it properly) :

In fact, the official website is not the only place where the latest version of Sync is not available on the documentation level, so I won’t give you a list of them because it’s not too important. I wonder if the Spring Cloud team is short of staff. Is there a service? O ha ha ~ O (studying studying)

Spring Cloud version management

Versioning is so important to software development that before Spring Boot dependencies, versioning was a big deal (even if there was a Spring BOM), especially when versioning didn’t work out that it could easily steal an afternoon or even a whole day.

As the upper application framework, Spring Cloud can only work properly if the lower version is matched. The most important thing is to align the version number with Spring Boot.

Mapping with the Spring Boot version

The advent and popularity of Spring Boot has greatly alleviated these problems, but the relationship between the Spring Cloud and the Spring Boot version still needs special attention when using Spring Cloud. I’ve compiled this chart for you:

Release Train Release time The Spring version of the Boot SC version of the Commons
X 2020.0. 2020-12 X 2.4. 3.0.0
Hoxton The 2019-07 2.2.x, 2.3.x (from SR5 onwards) X 2.2.
Greenwich The 2018-11 X 2.1. X 2.1.
Finchley The 2017-10 X 2.0. X 2.0.
Edgware The 2017-08 X 1.5. X 1.3.
Dalston The 2017-05 X 1.5. X 1.2.
Brixton The 2016-09 X 1.3. X 1.1.
Angel The 2016-05 X 1.2. X 1.0.

Note: For the internal components of Spring Cloud, Spring Boot, Spirng Framework, Security and other huge system version control relationship, the article has been sorted out, the next issue, please remember to search for hidden oh

Note: Spring-Cloud-starter-loadbalancer is commercially available with Spring Cloud Commons 2.2.0 (Hoxton). Please pay attention to this node because it replaces the Ribbon.

Current supported version

Spring Cloud follows the Pivotal OSS Support Policy protocol to provide three years of support for major releases. In addition, after a major or minor release of Spring Cloud, significant bugs and security issues are maintained for a period of time (anywhere from 6-12 months).

Special note: this refers to the major version is only 3 years, the major version is not often oh

Now that version 2020.0.0 has been released, it’s time to phase it out again. Currently, Spring Cloud officially supports the following versions:

  • Version 2020.0(Supports Spring Boot 2.4.x) It isMajor versionIt is scheduled to be supported until December 2023
    • It is the next major release since Finchley
  • Hoxton release :(supports Spring Boot 2.2.x and 2.3.x) as a minor release in the Finchley release series, it will be in regular maintenance until the end of June 2021. From 2020-07, there will be a special maintenance period (no new features, only urgent bug fixes), only major bugs/security patches will be released from 2021-december
  • Greenwich version :(support Spring Boot 2.1.x) it stopped maintenance in 2020-01 and will end its special maintenance period in 2020-12-31
  • Finchley release :(supports Spring Boot 2.0.x) it is the beginning of a major release, released in 2018
  • Older version: Well, forget it

Spring’s official advice: Use the latest version whenever possible. But the suggestion is that, as people who only use late mass technology, we feel safe sitting in the second or even third row. But the waves of history will always wipe out the front row, so it’s always a good idea to prepare early so you don’t end up swimming naked when you’re pushed to the front.

As a major release, Spring Cloud 2020.0 brings a number of significant changes, including some blocking updates (not backward compatible) that are the highlight of this article.

Blocking upgrade (not backward compatible)

Around this time last year, Spring Cloud announced the end of its Roadmap for several libraries/releases, the most important of which was that the Spring Cloud Netflix project went into maintenance mode, with plans to remove it completely in 2020.

Spring Cloud was forced to make this decision. We know that Spring Cloud has always had the Netflix OSS suite as its official default one-stop solution, and the Netflix OSS suite at the time wished it could be equated with Spring Cloud. Netflix announced around 2018 that its core components Hystrix, Ribbon, Zuul, Archaius and others were all in maintenance.

There are Zuul 2.x and Archaius 2.x, but they are not backward compatible and do not upgrade smoothly, so they are almost unusable

The modules that have been in maintenance since 2018 (including their corresponding starter, not listed here) are:

  1. spring-cloud-netflix-archaius
  2. spring-cloud-netflix-hystrix-contract
  3. spring-cloud-netflix-hystrix-dashboard
  4. spring-cloud-netflix-hystrix-stream
  5. spring-cloud-netflix-hystrix
  6. spring-cloud-netflix-ribbon
  7. spring-cloud-netflix-turbine-stream
  8. spring-cloud-netflix-turbine
  9. spring-cloud-netflix-zuul

1. Goodbye, Netflix

Today, Spring Cloud 2020.0 is officially released. In this major release, spring-Cloud-Netflix will finally be implemented as planned. Spring-cloud-netflix-dependencies XML file: spring-cloud-Netflix-Dependencies

  • spring-cloud-netflix-dependenciesIt’s not gone, it’s still there, version 3.0.x has been updated with the rest of the army
  • The old versionspring-cloud-netflix-dependenciesManages all Netflix components, including Hystrix, Ribbon, Zuul, Eureka, and more. As of version 2020.0,It has and only manages Eureka (both Server and Client)

Note: Feign was originally owned by Netflix, but since version 9.x it has been transferred to the OpenFeign organization, so it is no longer part of Netflix

In a nutshell: Spring Cloud 2020.0.0 completely removes all components of Netflix except Eureka. At this point, we can say thank you and goodbye to the Netflix OSS suite with a grateful heart.

Note: Netflix’s Eureka project is still active. The design of this registry is quite excellent, its overall performance is fair, and its competitiveness in the market is still commendable. Therefore, Spring Cloud has not given up on it yet

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
Copy the code

Netflix component alternatives

Now that Spring Cloud has decimated the Netflix OSS suite, there must be an alternative. Of course, the Spring Cloud team recommended alternatives:

Netflix Recommend alternatives instructions
Hystrix Resilience4j Hystrix itself recommends using it instead of yourself
Hystrix Dashboard / Turbine Micrometer + Monitoring System To put it bluntly, monitoring is left to a more specialized component
Ribbon Spring Cloud Loadbalancer Unable to resist, Spring finally took matters into his own hands
Zuul 1 Spring Cloud Gateway Unable to resist, Spring finally took matters into his own hands
Archaius 1 Spring Boot external configuration + Spring Cloud configuration Better and more powerful than Netflix
What is Spring Cloud LoadBalancer?

Perhaps the most unfamiliar and curious of the alternatives above is Spring Cloud Loadbalancer, which was once a small project in the Spring Cloud incubator and ran aground. The Ribbon is now the only implementation of Spring Cloud load balancer to completely replace the Ribbon.

It’s worth noting that Spring Cloud LoadBalancer was first introduced in Spring Cloud Commons 2.2.0, when Hoxton was released, but it was still a backup and Ribbon was the default. The following screenshot is from the Hoxton version:

As shown in figure, load balancing abstract LoadBalancerClient interface has two implementations, and in the Spring after the Cloud version 2020.0, BlockingLoadBalancerClient is the only true.

IO /guides/gs/s to loadbalancer with spring-cloud-loadbalancer

Is Spring Cloud Alibaba an alternative?

Well, that’s fine.

However, it is not currently the official recommended default of Spring Cloud. We look forward to working together to send Spring Cloud Alibaba as soon as possible, so that we can use the framework of China, and the issue must be in Chinese.

Can Netflix package import work normally?

They wanted to upgrade to the latest version of Spring Cloud while remaining downward-compatible using Netflix’s technology. < span style = “box-sizing: inherit! Important; color: RGB (51, 51, 51); font-size: 14px! Important; white-space: inherit! Important;” Can it work properly?

A: I’ll pat you on the head and give you an answer, no. Since I haven’t demonstrated it, but it’s a monstrous use, it should be shot in the bud, it shouldn’t be.

In addition, from this also tell us: When using Spring Cloud, try to program for its abstraction, so that even if Spirng Cloud changes the underlying components (such as fuses, load balancers), theoretically there is no impact or little impact on our business, thanks to its Spring Cloud Commons abstraction, where is the essence.

2. The Bootstrap context is no longer started by default

Know principle of classmates know, Spring Cloud container is to rely on the Bootstrap Context guide Context to start, the corresponding class is BootstrapApplicationListener.

This changes in version 2020.0, where the new version of Spring Cloud is no longer launched in this context. Therefore, by default, the Bootstrap context is no longer started. The code level changes happen here:

BootstrapApplicationListener:@Override
	public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
		ConfigurableEnvironment environment = event.getEnvironment();
		// add this judgment 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);
	}
Copy the code

Open means

If you need to enable the Bootstrap context, you can do so in two ways:

  1. Set the valuespring.cloud.bootstrap.enabled=trueorspring.config.use-legacy-processing=trueCan. Note: these attribute values must be placed in the environment to take effect. For example, reliable methods are: system properties, environment variables, command line, etc
  2. Import a Jar:org.springframework.cloud:spring-cloud-starter-bootstrap“And then nothing to do
    1. Description: This jar contains one and only oneMarkerClass, you know, I won’t explain too much here

Bootstrap context is enabled manually to prove that you are fallback to the old way to load SC, so please follow the old way to do it

3. New configuration mode

Since Spring Boot 2.4.x supports a new way of writing configuration files, you can import the configuration of other components using spring.config.import. Such as:

  • spring.config.import=configserver:xxx
  • spring.config.import=zookeeper:
  • .

This is more modular and more compatible with cloud native environments.

4, other

  • To disable the Spring Cloud Config Client health indicator, use thehealth.config.enabled=false, now changed tomanagement.health.config.enabled=false. Maintains the same style as Spring Boot control endpoints
  • Endpoint IDS with invalid characters (dashes) have been changed to compliant, and there are no more nasty warnings at startup, to the rescue of cleanliness freaks.
    • bus-env -> busenv
    • bus-refresh -> busrefresh
    • service-registry -> serviceregistry
// old
@Endpoint(id = "service-registry")
public class ServiceRegistryEndpoint {... }// new
@Endpoint(id = "serviceregistry")
public class ServiceRegistryEndpoint {... }Copy the code

Conventional upgrade

Regular upgrades are less of a concern, focusing on components such as Spring Cloud Commons, Spring Cloud Kubernetes, Spring Cloud Openfeign… And so on to do some routine upgrades, not much.

One thing to watch: All Module versions of the Spirng Cloud have been upgraded to 3.0.0 (large version upgrades), Except Spring Cloud Circuitbreaker/Spring Cloud Kubernetes (2.0.0) and Spring Cloud Task (2.3.0).

There are still problems

Although 2020.0 has been released, there are still unresolved problems. Examples are several existing problems of this version:

  • If usespring.config.import=configserver:To configure the configuration center. This release misses the support Retry parameter
    • Solution: If you want to use it, you will have to fallback to the traditional method (written in bootstrap.yaml).
  • spring-cloud-config-dependenciesA non-release version of the JAR appears in the
    • Solution: Manually specify the version number of the JAR

Note: M1 is a milestone version, still belongs to the early stage, there may be bugs, it is recommended that you manually specify the version number to replace this JAR

It seems that even strong as the Spring team, there are all kinds of bugs. If I think so, I dare to go back and write a bug.

✍ summary

Spring Cloud 2020.0.0 is the major release of Spring Cloud. It is a very important presence, and the upgrades and changes are huge. In particular, the removal of all Netflix modules, the change of Spring Cloud startup mode, etc. With the release of Spring Boot 2.4.x and Spirng Cloud 2020.0, and the removal of Netflix OSS suite, there will be a new deep programming experience, full of surprises and looking forward to it.

Note: Because this version completely eliminates a Netflix set of things, in order to keep up with The Times, I will use the latest version of the series of tutorials as soon as possible, to help you step on the hole

At the end of the article it was noted that version 2020.0 had been released, but there were still some problems. However, those are minor issues and will probably be fixed in the next minor release. Embarrassingly, the end of 2020 is less than 10 days away, and if we move to 2021, the new version will no longer be called 2020.x.x, but 2021.x.x, which is clearly an iteration of a larger version.

Do you think the Spring Cloud team will release in 2020? Feel free to leave your thoughts in the comments section.


Let me introduce you to them

Spring type conversion series:

  • 1. Uncovering Spring type conversions – the cornerstone of framework design
  • 2. Early type conversion of Spring, based on PropertyEditor implementation
  • 3. Wrap it up and PropertyEditor is here
  • 4. New Spring, a new generation of type conversion mechanism
  • 5. Through the crowds, Spring has made a premium track for you
  • 6. Bridge the differences and unify the type ConversionService ConversionService

【Jackson】 Series:

  • 1. Get to know Jackson — the best JSON library in the world
  • 2. Holy shit, Jackson wrote JSON like this
  • 3. Knowing this, Fang dared to say on his resume that he could write JSON with Jackson
  • 4. How are JSON strings parsed? JsonParser
  • It’s just a JsonFactory. It’s interesting. I didn’t expect this
  • 20 not confused, ObjectMapper use is no longer confused
  • 7. Jackson: Using tree models to handle JSON is a must

Validation Bean Validation

  • The first article will improve your understanding of Bean Validation data Validation
  • Validates method parameters and return values
  • 3. On the usage side, Bean Validation is the standard interface that you need to be familiar with
  • Every one of the five core components of a Validator should be included
  • There are four levels of declarative Validation: fields, attributes, container elements, and classes
  • 6. User-defined container type element validation, class level validation (multi-field joint validation)

[New features] Series:

  • IntelliJ IDEA 2020.3 is officially released, and the last version of the year is very martial morality
  • IntelliJ IDEA 2020.2 is officially released. There are always a few highlights to help you improve the efficiency
  • IntelliJ IDEA 2020.1 is now available!
  • Spring Framework 5.3.0 has been officially released, continuing its efforts on the cloud native road
  • New configuration file loading mechanism (not backward compatible)
  • Spring changes naming rules for version numbers: this move is friendly to non-English speaking countries
  • JDK15 is officially released, and the landmark ZGC is officially announced

Program Life series:

  • Ant Financial went public. I don’t want to try
  • If both programmers and product managers use Versailles literary dialogue……
  • Program life | percussion horseshoe disease, a day to see changan flowers

There are also things like [Spring configuration class] [Spring-Static] [Spring data binding] [Spring Cloud Netflix] [Feign] [Ribbon] [Hystrix]… More original columns, pay attention to BAT’s Utopian reply column two words can be all obtained, can also add me FSX1056342982, make a friend.

Some are finished, some are in series. I’m YourBatman, and I’ll see you next time