The Spring family is very large, from the earliest emergence of Core, which serves the development of enterprise programs, Security in Security, to Data, which serves as a bridge of various Data sources, and Boot, which is very popular in recent years. And the latest launch of the burgeoning Cloud (referred to simply as Boot for the rest of this article, Cloud omits Spring to save me a bit of typing time).

The brain map above shows some of the main members of the Spring family. The non-cloud part on the right is listed with features, and the Cloud part on the left is complex but structured (yes, the new version is much clearer and has uniform naming, you can zoom in to see if these are familiar). So it further lists some of the module dependencies required by the component and the main annotations that enable the functionality.


I’m talking about the evolution of Spring

The Spring framework covers almost all aspects of Java enterprise service development, and it also integrates and ADAPTS almost all common development patterns, middleware, and databases.

When I was talking about the Internet architecture pattern, I said that it is often easy to write down the logic of a business, but it is difficult to extract the logic into a pattern and then package it into a framework for everyone to use. Only after we have experienced enough scenarios can we extract a general functional framework that most people can use, and we need to open up the configurable parts for core functionality to meet the needs of a small number of people to further customize and extend functionality.

The Spring framework goes through several phases:

· Core, Security and Data launched in the first stage are designed to provide good services for single application development. Not only provides convenient database access, Web MVC and other necessary functions, but also through AOP, IOC two powerful tools to enable our program to achieve low coupling and extensible.

· The significance of Boot launched in the second stage is not only to accelerate the development efficiency, but also to make our program from usable to usable. The core business logic of the application program may only be 70% of the workload, and 30% of the workload such as monitoring logs should be done to make the program run happily online.

· The significance of Cloud launched in the third stage is that it promotes the implementation of micro-service architecture. Small Internet companies that don’t have the infrastructure to develop microservices can enjoy free out-of-the-box microservices solutions. In fact, many people do not look at the microservices architecture to find a solution, but learn about the Spring Cloud to understand the microservices idea and then land.

· Currently in the fourth stage, vigorously developing Cloud Dataflow+ container. Dataflow’s idea is that services that do real-time message processing and temporary tasks can be considered components of services, and that if you can have a DSL that defines how these components interact and then freely combine, deploy, and scale in a container, the architecture can be very flexible. Below is a diagram of the Dataflow administration interface.


The development of Spring can be seen in the development of Internet architecture. Spring has brought us a lot of technical inspiration, from the inspiration of software design pattern to the inspiration of architecture. I even think Spring has created the template of architecture style for Java development. I wonder where the application architect is going at this point.


I said the Spring Core

Spring Core’s IOC and AOP capabilities have become half the lifeblood of Java. Many development platforms don’t emphasize IOC and AOP that much, and some don’t support it at all. While I have always felt that IOC and AOP are good ideas for making components less coupled, easily replaceable, and easily extensible within our software, it is my view that as a class library you should not leave the initialization and assembly of your components outside of you. We know that by using the IOC container to manage the instantiation and dependencies of our components, we can implement each component internally, leaving the assembly to XML configuration, but for some complex components, if the configuration is done by XML, it is also done by the user. This is equivalent to requiring the user to understand the internal assembly structure of the component, which is not reasonable. It makes more sense for the author of a component or framework to provide extension points that allow consumers to explicitly inject their own extension or implementation components through the API, and out of the box without configuration for those who simply want to use the components.


Of course, this is not to say that Spring’s IOC and AOP are bad, because the framework implementation is so flexible, Java using Spring as a container is almost standard, so many frameworks in the Java world can be well integrated with each other, it is indeed a good platform.


Spring 5 introduces a Reactive non-blocking stack, based on Netty or Servlet 3.1+ containers, that provides a Stream API, WebFlux, and a variety of responsive storage (various NOSQL) access libraries. Implementing non-blocking services from front to back can avoid IO blocking occupying threads, reduce thread switching and resource usage, and maximize concurrency with minimal resources. Unfortunately, there is no non-blocking version of JDBC, so our mainstream mysql-based applications can’t do non-blocking IO over a full link (from Controller to external Rest services to the database). In addition, after simple use of Reactive suite, I feel that the API is very difficult, and the chain call is not readable. Moreover, I have encountered some concurrent pit, and there are few code examples and best practices, so I feel that the use of Reactive suite is not very mature.


I said Spring Data

Spring Data wants to make it easier to use various Data stores with a relatively consistent Template API. I personally don’t like to get used to the Data suite and prefer Java native clients that use various NOSQL. Several reasons:

· The native client follows the implementation of the server and can experience the latest functions at the first time

· Native client API and server API often match one by one, which can be used in a more accurate way

· Native clients tend to be simple apI-based packages with better performance

Of course, Spring Data might be easier to use if we were just using NOSQL briefly.


I said Spring to Boot

A little bit old Java development basic is from pure XML configuration to XML + 3 annotation configuration, more interesting is a lot of development while in the use of XML configuration, but often ask them the meaning of each configuration can accurately answer, basic is holding a supervisor or predecessors of a set of XML configuration direct copy and paste when using. As a side note, most of our Mybatis/Spring MVC configuration is a matter of component initialization rather than customization. These basic configurations are required to make a component work from zero, and in that case, it is perfectly possible to have default configurations, convention over configuration. We do more configuration only when we need to customize the components.


Spring Boot does a lot to automate configuration, simplify configuration, and provide a lightweight, embedded container that instantly implements a self-starter application with just 20 lines of Pom+10 lines of code (easy to deploy), inspiring us to use microservices. In addition, it makes many production-ready actuators for us, telling us that a complete application should pay attention to environment switch, monitoring, logging, and operation. All in all, setting up a project that might have taken half a day before can now take 10 seconds with start.spring. IO. Before Boot, I really had no interest in creating an experimental console application using heavy Java (probably just to access the database for some processing, or Python anyway).


I said Spring Cloud


The image above is from the front page of the website and illustrates the relationship between the various components. Let’s walk through the components of the brain map:

· Configuration management Cloud Config: provides client and server. The client is perfectly combined with Spring. The server provides Git and file data storage, and the latest version also provides database. This configuration management function is far from those CONFIGURATION management functions I explored in the article “Zhu Ye’s Internet Architecture practice S1E5: Basic Middleware for Continuous Cultivation”.

· Service discovery Netflix Euerka: Provides client and server (and management desk). The client here refers to the user of service discovery. In fact, the service in micro-service is the client here.

· Circuit breaker Netflix Hustrix: provides client API, aggregation server Tubine and Dashboard website.

· Service Gateway: There are two gateways to choose from: Netflix Zuul and Cloud Gateway, which is said to have better performance. In fact, the gateway is a typical implementation mechanism of Filter+Handler. It finds the appropriate Handler through routing and calls various plug-in filters of Pre and Post.

· Call chain tracking Cloud Sleuth: It can be used with Zipkin, and the function can only be said to be workable. The background function of Zipkin is still too weak compared with the Trace background function implemented by the mainstream Internet in China.

· Message-driven Cloud Stream: abstraction becomes the Source of message output, Sink of data consumption and Processor of data capture and exchange. The Broker implementation is then decoupled with binders to support the main Kafka, KafkaStream and RabbitMQ types.

· Message Bus Cloud Bus: Abstracts the functions of MQ and supports mainstream MQ products.

· Function as a service Cloud Function: Encapsulates functions as Web services or Stream services that can be called independently. Function programming, Consumer, and Supplier map to Processor, Sink, and Source, respectively.

· Micro-service Contract Cloud Contract: contract-first programming can be implemented. The Contract can be defined to test the Contract and service implementation can be carried out at the same time. Complex services can be done in this way, with consumer providers writing their own to contracts without delay.

· Task framework Cloud Task: The concept of non-scheduled Task, where a Task refers to a process that runs once. The framework provides the most basic functions of task execution audit management. The tasks here can eventually run in Cloud Dataflow or independently.

· Management console: The Admin console listed here is provided by a third party and can display and monitor information comprehensively based on the endpoints of the Actuator.


To sum up, on the whole, I think Cloud’s modularization idea is good. Modules and modules can be used together. However, there may be no systematic planning at the beginning. It’s a lot of potholes to use them all, and you need to keep updating the framework version to enjoy new features.


From the current function of the degree of perfection, I feel that the core function of the degree of perfection is 60% (about one year of development can be used more comfortable). Too humble background, with official background scattered ugly and complete degree is very low (compared to the domestic a line in the management of the development of the Internet function, improve the degree of around 30%, it may require the development of the 2 years can use more comfortable, if we can have a good planning and a complete set of background service governance all related functions are integrated together is good). Anyway, at least Cloud suite is a set of complete solutions, now is not comparable to other open source selection can be used (Dubbo we also know that although now began to the iteration, but due to its original location is the RPC framework, ideas, and there are a lot of different components is not as perfect Cloud).


In addition to the function is not perfect, the Cloud is worried me a little (I haven’t tested, but seeing the function of the iteration speed for this lack of confidence, who has a large scale could give some data), the middleware (service discovery, gateway service, link tracking, configuration management) is pressed, whether can meet larger pressure, If only the implementation of the function, may be in full use after the performance bottleneck, at this time I am afraid of trouble.


conclusion

The Spring family is already a powerful behemoths, and it’s not uncommon to have dozens of Spring dependencies in our project POM. It’s been a few years since I used the.net family suite, but I still feel Microsoft. NET development suite is superior to Spring MVC, Data JPA (now everyone uses Mybatis, Mybatis is still too weak), Cloud suite in function and elegance of design, no matter MVC, ORM or RPC. Hopefully we’ll see Spring continue to work on these points and continue to build the Dataflow suite with K8S as a microservice OS (with various middleware enabling one-click deployment clusters). In addition to the core functions of Spring Cloud, I hope to continue to improve the management desk to create an integrated management desk (not necessarily a website, but at least with access control and audit and SSO). Fully realize microservices deployment scaling, service governance, Dataflow management, service full-link monitoring, configuration management and other functions, and also expect Spring Cloud and Dataflow to work together to define the architecture standards of microservices and data-centered flow processing in the next two to three years.