A,Spring

Spring makes programming Java quicker, easier, and safer for everybody. Spring’s focus on speed, simplicity, and productivity has made it the world’s most popular Java framework.

Spring makes Java programming faster, easier, and safer for everyone. Spring’s focus on speed, simplicity, and productivity has made it [the world’s most popular]Java framework.

features

  • Microservices: Quickly Deliver production grade features with independently evolvable Microservices.
  • Reactive: Spring’s Asynchronous, nonblocking architecture means you can get more from your computing resources.
  • Cloud: Your code, any Cloud — We’ve got you covered. Connect and scale Your services, whatever Your platform.
  • Web Apps: Frameworks for fast, secure, and Responsive Web Applications connected to any data store.
  • Serverless: The ultimate flexibility. Scale up on demand and Scale to zero when there’s no demand.
  • React to business events. Act on your Streaming data in realtime.
  • Batch:Automated tasks. Offline processing of data at a time to suit you.

Projects Overview

Spring is an ecosystem, or a technical system, a collection of many technologies, including many sub-projects, such as Spring Framework, Spring Boot, Spring Cloud, etc. Spring is often referred to as Spring in a narrow sense. It actually refers to the Spring Framework.

Second,Spring Framework

The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications – on any kind of deployment platform.

The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications on any type of deployment platform.

A key element of Spring is infrastructural support at the application level: Spring focuses on the “plumbing” of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.

A key element of Spring is infrastructure support at the application level: Spring focuses on the “plumbing” of enterprise applications so that teams can focus on application-level business logic without having to be tied to a specific deployment environment.

features

  • Core technologies: dependency injection, events, resources, i18n, validation, data binding, type conversion, SpEL, AOP.
  • Testing: mock objects, TestContext framework, Spring MVC Test, .WebTestClient
  • Data Access: transactions, DAO support, JDBC, ORM, Marshalling XML.
  • Spring MVC and Spring WebFlux web frameworks.
  • Integration: remoting, JMS, JCA, JMX, email, tasks, scheduling, cache.
  • Languages: Kotlin, Groovy, dynamic languages.

advantages

  • Decouple code and simplify development. With the IOC container provided by the Spring Framework, users can leave dependencies between objects to the Spring Framework to manage, avoiding excessive program coupling caused by hard coding.
  • Support for AOP programming. AOP functionality provided by the Spring Framework facilitates section-oriented programming.
  • Support for declarative transactions. In the Spring Framework, the disadvantages of hard coding of programmatic transactions can be avoided, and transaction management can be implemented flexibly through declarative way, improving development efficiency and quality.
  • Make Java EE apis easier to use.

disadvantages

  • It takes a long time to get started with Spring.
  • Compatibility with outdated technologies, resulting in increased use complexity.
  • Too many configurations. XML configuration is no longer a popular way to configure a system.
  • When integrating third-party tools, programmers also need to consider compatibility between tools.
  • The system starts slowly and does not provide the hot deployment function. The system depends on the hot deployment of VMS or Web servers.

The Spring Framework is the cornerstone of the entire Spring ecosystem. It has two important design cores, IOC (Inversion of Control) and AOP (aspect oriented programming), on which Spring relies. It is the elimination of Java’s official enterprise development standard EJB, so as to achieve the world domination. Spring provides core support for dependency injection, transaction management, WEB applications, data access, and more. However, no matter how simplified and elegantly designed the Spring Framework interface is, it is always passive: because it is not itself a container, it basically has to be loaded with JavaEE containers such as Tomcat, Jetty, JBoss, and so on when they start. However, the emergence of Spring Boot has changed the status quo of Spring Framework and even the whole Spring technology system.

Three,Spring Boot: Build Anything

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”.

Spring Boot makes it easy to create stand-alone, production-grade, Spring-based applications that you can “run.”

We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need minimal Spring configuration.

We take a very opinionated view of the Spring platform and third-party libraries, so you can get started with minimal hassle. Most Spring Boot applications require minimal Spring configuration.

If you’re looking for information about a specific version, or instructions about how to upgrade from an earlier release, check out the project release notes section on our wiki.

If you’re looking for information about a particular release, or instructions on how to upgrade from an earlier release, check out the project Release instructions section on our Wiki.

features

  • Create stand-alone Spring applications
  • Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
  • Provide opinionated ‘starter’ dependencies to simplify your build configuration
  • Automatically configure Spring and 3rd party libraries whenever possible
  • Provide production-ready features such as metrics, health checks, and externalized configuration
  • Absolutely no code generation and no requirement for XML configuration

Spring Boot takes advantage of JavaConfig’s deployment mode and its design concept of “Convension Over Configuration” (COC). It provides a number of spring-boot-starter auto-configuration dependencies for enterprise application development scenarios right out of the box.

  • The official starter is named spring-boot-starter-xxx
  • The unofficial starter is named xxx-spring-boot-starter

Convension Over Configuration, also called programming by convention, is a software design paradigm that convenes developers in reducing the number of decisions they have to make, reap the benefits of simplicity, not flexibility.

advantages

  • It integrates mainstream frameworks without configuration and automatically integrates third-party frameworks.
  • Spring projects can be run independently, and Spring Boot can be run independently in the form of JAR packages. The project can be successfully run using the java-jar command or by executing the main function in the project’s main function.
  • Embedded server, capable of rapid deployment. Integrates the Tomcat (default), Jetty, and Undertow containers.
  • There are many plugins that allow us to quickly build a Spring project out of the box and run a JavaEE project with very little configuration.
  • Pure Java configuration with no code generation and no XML configuration required. It also provides a series of non-functional generic configurations.
  • Significantly reduced development time and increased productivity.
  • .

disadvantages

  • Automatic configuration makes it difficult to locate faults.
  • Version iteration speed is too fast and some modules are changed too much.
  • Integration is too high, want to know the bottom cost is large.

Spring Boot makes it very easy to create a stand-alone, production-grade Application based on the Spring Framework. Then, “Just run”. Spring Boot integrates many third-party packages by default so that you can start a project with minimal cost. It can be said that Spring Boot is the Development of Java enterprise applications for a mighty revolution. If you have a few years of experience, you probably remember the old Java Web development model: Tomcat + WAR package. The WEB project is based on the Spring Framework, the project directory must be standard WEB-INF + classes + lib, and a lot of XML configuration. Whereas it used to take an hour to set up a Web project with an SSH architecture, it now takes 10 minutes.

Spring Boot is a new automated configuration solution driven by the @Enable annotation module of the Spring Framework. Designed for quick startup and minimal configuration of Spring applications, it has a solid set of views for building production-grade applications.

Four,SpringCloud: Coordinate Anything

Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one-time tokens, global locks, leadership election, distributed sessions, cluster state). Coordination of distributed systems leads to boiler plate patterns, and using Spring Cloud developers can quickly stand up services and applications that implement those patterns. They will work well in any distributed environment, including the developer’s own laptop, bare metal data centres, and managed platforms such as Cloud Foundry.

Spring Cloud provides developers with tools to quickly build certain common patterns found in distributed systems (e.g., configuration management, service discovery, circuit breakers, intelligent routing, micro-proxies, control buses, one-time tokens, global locks, leadership elections, distributed sessions, cluster state). Coordination of distributed systems leads to boilerplate styles, and developers using Spring Cloud can quickly get up and implement boilerplate services and applications. They work well in any distributed environment, including the developer’s own laptop, bare-metal data centers, and hosted platforms such as Cloud Foundry.

features

Spring Cloud focuses on providing good out of box experience for typical use cases and extensibility mechanism to cover others.

  • Distributed/versioned configuration
  • Service registration and discovery
  • Routing
  • Service-to-service calls
  • Load balancing
  • Circuit Breakers
  • Global locks
  • Leadership election and cluster state
  • Distributed messaging
Core elements of microservices Spring Cloud technology stack implementation
Service registration and discovery Eureka, Spring Cloud Alibaba Nacos, Spring Cloud Consul, Spring Cloud Zookeeper
Service configuration and management Spring Cloud Config、 Spring Cloud Alibaba Nacos
Service fuse Spring Cloud Netflix Hystrix、 Spring Cloud Alibaba Sentinel、 Spring Cloud Circuit Breaker Resilience4J
Service interface invocation (simplified tool for clients to invoke services) Spring Cloud OpenFeign
Client load balancing Spring Cloud Netflix Ribbon
Service Routing (API Gateway) Spring Cloud Netflix Zuul, Spring Cloud Gateway
Full link tracing Spring Cloud Sleuth
Event message bus Spring Cloud Bus
Distributed transaction Spring Cloud Alibaba Seata
message-driven Spring Cloud Stream

Service registration and discovery

Nacos Eureka Consul Zookeeper Etcd SOFARegistry
language Java Java Go Java Go Java
website nacos.io Github.com/Netflix/eur… www.consul.io zookeeper.apache.org coreos.com/etcd www.sofastack.tech/projects/so…
Github Github.com/alibaba/nac… Github.com/Netflix/eur… Github.com/hashicorp/c… Github.com/apache/zook… Github.com/etcd-io/etc… Github.com/alipay/sofa…
CAP CP+AP AP CP CP CP AP
Service health check CP+AP AP CP CP CP AP
Kv storage service N/A N/A support support support N/A
Using interfaces (multilingual capability) gRPC / Dubbo / REST Client/HTTP Supports HTTP and DNS The client HTTP / gRPC Client (Java)
Watch support Long Polling/ most increments is supported Long Polling/ most increments is supported Full/Long Polling is supported support Support Long Polling Support (server push)
Spring Cloud integration support support support support support support
Dubbo integration support Does not support Does not support support support support

The gateway

Kong Spring Cloud Zuul (based on Zuul 1.x) Spring Cloud Gateway
introduce Nginx(OpenResty) + Lua plug-in, high performance Java + Servlet + Groovy(Hot Update) Java + Spring 5.0 + Reactor non-blocking
website konghq.com Github.com/Netflix/zuu… Spring. IO/projects/sp…
Github github.com/Kong/kong Github.com/Netflix/zuu… Github.com/spring-clou…
Developer divide Kong (Mashape) company Netflix Pivotal
The main purpose Enterprise API Management Microservice Gateway Microservice Gateway
Ease of development Lua scripting language, which is difficult Java + Servlet, easy Reactor asynchronous, difficult
Whether open source Open Source/Enterprise edition Open source Open source
Support agreement RESTful API RESTful API RESTful API
API registration/dynamic routing Managed through the Admin API Dynamic routing Dynamic routing
Current limiting support Need to develop support
fusing support Need other components support
retry support support support
Health check support support support
Load balancing algorithm Polling, hash Polling, random, weighted polling, custom Polling, random, weighted polling, custom
permissions Built-in multiple ways The development of implementation The development of implementation
Tracing support Need other components Need other components
Support Yaml support support support

Service configuration and management

Nacos Apollo Spring Cloud Config
language Java Java Java
website nacos.io Github.com/ctripcorp/a… Spring. IO/projects/sp…
Github Github.com/alibaba/nac… Github.com/ctripcorp/a… Github.com/spring-clou…
Configuring Real-time Push Support (HTTP long polling within 1s) Support (HTTP long polling within 1s) Support (Spring Cloud Bus)
Version management support support Support (Git)
Configure a rollback support support Support (Git)
Gray released Does not support support support
Rights management Does not support support Support (Git dependent)
Multiple clusters support support support
Many environmental support support support
Listening to the query support support support
multilingual A mainstream language that provides an Open API A mainstream language that provides an Open API Only support Java
Configuration format verification support Does not support Does not support

Service fuse

Sentinel Hystrix Resilience4j
language Java Java Java
website sentinelguard.io/zh-cn/ Github.com/Netflix/Hys… N/A
Github Github.com/alibaba/Sen… Github.com/Netflix/Hys… Github.com/resilience4…
The main purpose Semaphore isolation (concurrent thread flow limiting) Thread pool isolation/semaphore isolation Semaphore isolation
Fuse downgrading strategy Based on response time, exception ratio, number of exceptions Based on abnormal ratio Based on exception rate, response time
Real-time statistical implementation Sliding Windows (LeapArray) Sliding Windows (based on RxJava) Ring Bit Buffer
Dynamic Rule Configuration Support for multiple data sources Support for multiple data sources Support co., LTD.
scalability Multiple extension points Plug-in form Interface form
Annotation-based support support support support
Current limiting Based on QPS, traffic limiting based on call relationships is supported Limited support Rate Limiter
Traffic shaping Support preheating mode, constant speed mode, preheating queuing mode (can be configured in flow rules) Does not support Simple Rate Limiter mode
System adaptive protection support Does not support Does not support
The console Provides out-of-the-box console for configuring rules, viewing second-level monitoring, machine discovery, and more Simple monitoring view No console is provided, and other monitoring systems can be connected

Full link tracing

CAT Zipkin Pinpoint Skywalking
language Java Java Java Java
website konghq.com zipkin.io/ Github.com/naver/pinpo… skywalking.apache.org/zh/
Github Github.com/dianping/ca… Github.com/openzipkin/… Github.com/naver/pinpo… Github.com/apache/skyw…
implementation Code burying points (interceptors, annotations, filters, etc.) Intercepts requests and sends (HTTP, MQ) data to the Zipkin service Java probe, enhanced bytecode Java probe, enhanced bytecode
Storage option Mysql, HDFS In-memory, Mysql, Cassandra, Elasticsearch HBase + Mysql Elasticsearch, H2, Mysql, TiDB
Communication mode NIO data transmission based on Netty HTTP, MQ Thrift gRPC
Invasion degree The larger The relatively small Bytecode probe technology, code non-invasive Bytecode probe technology, code non-invasive
MQ monitoring Does not support Does not support Does not support Support (RocketMQ, Kafka)
Global call statistics support support Does not support support
Trace the query Does not support support Does not support support
Call the police support Does not support support support
The JVM monitoring Does not support Does not support support support
advantages Fully functional. Spring-cloud-sleuth is a great way to integrate Zipkin, code is non-invasive, integration is very simple and the community is much more active. Completely non-invasive, only need to modify the startup mode, perfect interface, detailed functions. Completely non-invasive, perfect interface, support application topology and a single call chain query. With perfect functions (Zipkin + Pinpoint)
disadvantages 1. The code is highly intrusive and needs to be buried. 2. The document is in disorder, and the consistency between the document and the release version is low, so we need to rely on the review private server (or manually download the JAR from his private server and upload it to our private server). 1. By default, Http requests are used to report information to Zipkin, which consumes performance. 2. Combine Sleuth with RabbitMQ asynchronously, which increases the complexity. RabbitMQ is required. 3. Data analysis is relatively simple. 1. You cannot query a single call chain, which displays the call ecology of the entire application. 2. Secondary development is difficult 1. There are many bugs before version 3.2, and the compatibility is poor. More dependence.
The document Online information is less, only the official website provided documents, relatively messy documentation documentation documentation

advantages

  • Spring Cloud provides a full suite of microservice functional components, many of which are essentially “out of the box” and are well compatible with each other, simplifying development.
  • The components that Spring Cloud integrates are basically lightweight and are the best in their field.
  • Components are decoupled from each other, giving developers the flexibility to choose and match different components.
  • Spring Boot based development, convention over configuration, annotation-based, no configuration files.

disadvantages

  • Compared with other RPC frameworks, Spring Cloud does not limit the communication protocols between services. Mainstream clients such as RestTemple and Feign directly support the Ribbon for service registration discovery and intelligent routing. The underlying communication protocol is HTTP. It is possible that the performance of service calls will be compromised relative to RPC frameworks such as Dubbo.
  • From the perspective of microservice development, too many microservices and high governance costs are not conducive to system maintenance. The high cost of distributed system development (fault tolerance, distributed transactions, etc.) is a big challenge for the team.

Spring Cloud is an ordered collection of a series of frameworks and a complete set of Spring Boot-based microservice solutions. It takes advantage of the development convenience of Spring Boot to ingeniously simplify the development of distributed system infrastructure. A number of development kits are provided to provide service discovery registries, configuration centers, traffic limiting, gateways, link tracing, intelligent routing, message bus, circuit breakers, load balancing, and data monitoring.

The last

  • Spring is an ecosystem, or technology architecture, a collection of many technologies.
  • The Spring Framework is the cornerstone of the entire Spring ecosystem. The design core: IOC and AOP, is the foundation on which Spring relies, and all other Spring modules rely on it.
  • Spring Boot is a new automated configuration solution driven by the @Enable annotation module of the Spring Framework. Designed for quick start and minimal configuration of Spring applications, its emergence solves the difficulty of getting started with the Spring Framework, shielding a lot of low-level details, using JavaConfig, to solve a lot of XML configuration troubles.
  • Sring Cloud is a set of micro-service development tools based on Spring Boot, which simplifies the development complexity of distributed projects by utilizing the automatic configuration feature of Spring Boot.