In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "what is the technical system of the Java Spring family". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what is the technical system of the Java Spring family"?
1. Why
Spring Boot innovates and optimizes on the basis of the traditional Spring framework, liberates developers from the previous tedious configuration work, and provides a large number of plug-and-play integrated components, thus solving the complex integration process among various components, greatly improving the development efficiency and reducing the maintenance cost.
For example, the Spring MVC framework was originally used, and in the whole development process, in addition to writing a lot of configuration files and introducing special development components for each level, you also need to deploy and manage the application server independently. Finally, in order to effectively monitor the running status of the system, some external frameworks that are not easy to use need to be introduced.
The Spring Boot framework is used because it directly solves the problem of configuration, programming, deployment, monitoring, easy to use, simple and efficient.
The increasingly powerful Spring Boot has become the standard development framework in the field of Java EE. Being proficient in the technical components of Spring Boot and being able to master its internal operating mechanism to a certain extent is not only the basic requirement for Java application development, but also the basis for learning micro-service development frameworks such as Spring Cloud.
II. Panoramic picture of Spring family technology ecology.
Since the Spring framework was designed and implemented by Rod Johnson in 2003, it has experienced the development and evolution of many major versions, and has formed a huge family technology ecosystem. At present, Spring has been the most popular development framework in the field of Java EE, and it has been widely used in major enterprises all over the world.
Let's take a look at a panoramic view of the technology ecology of the Spring family.
As you can see from the figure, the seven core technology systems of the Spring framework are listed here, namely, micro-service architecture, responsive programming, cloud native, Web applications, Serverless architecture, event-driven and batch processing.
These technology systems are independent but also have some overlap. For example, micro-service architecture is often used in combination with Spring Cloud-based cloud native technology, and the construction process of micro-service architecture also needs to rely on Web applications that can provide RESTful style.
On the other hand, in addition to the specific technical characteristics, these technical systems also have their own application scenarios.
For instance
If we want to implement lightweight batch tasks such as daily reports, but do not want to introduce Hadoop, a huge offline processing platform, using Spring Batch-based batch processing framework is a good choice.
If you want to integrate with Kafka, RabbitMQ and other mainstream message middleware, and shield the differences in the use of these middleware, then the event-driven architecture based on Spring Cloud Stream provides a unified API, shielding the differences in the implementation of internal middleware.
In the daily development process, if you build a single Web service, you can use Spring Boot. If you want to develop a micro-services architecture, you need to use Spring Boot-based Spring Cloud, while Spring Cloud also has a built-in Spring Cloud Stream-based event-driven architecture.
At the same time, special emphasis is placed on responsive programming technology. Responsive programming is the biggest innovation introduced by Spring 5, which represents a technical direction of system architecture design and implementation. Therefore, we will also start from the three technical systems of Spring Boot, Spring Cloud and Spring responsive programming to see what specific problems Spring can solve for us in the development process.
III. The overall structure of Spring Framework
Of course, all the Spring family technology systems we can see today are gradually evolved on the basis of Spring Framework. Before introducing the above technical architecture, let's take a brief look at the overall architecture of Spring Framework.
IV. Spring Boot and Web applications
Spring Boot, which is based on Spring Framework, is a new generation of Web application development framework.
By visiting the official website of Spring, we can see that Spring Boot has become a top subproject in Spring. Since the release of version 1.0.0 in April 2014, Spring Boot has become the preferred framework for developing Web applications in the Java EE domain.
Let's first feel the coding work required to develop a RESTful-style HTTP endpoint using Spring Boot, as follows:
@ SpringBootApplication@RestControllerpublic class DemoApplication {@ GetMapping ("/ helloworld") public String hello () {return "Hello World!";} public static void main (String [] args) {SpringApplication.run (DemoApplication.class, args);}}
A classic "Hello World" program, and it only takes a few seconds to build such a RESTful-style Web application using Spring Boot.
Once you have created a Spring Boot application and added a DemoApplication class similar to the one above, we can start Spring Boot's built-in Web server and listen on port 8080, and all the rest of the work is done automatically by Spring Boot.
Support runtime embedded containers (traditional Web containers & non-blocking containers)
Spring Boot has the functional features that the traditional Spring framework does not have, that is, it supports runtime embedded containers (including Tomcat, Jetty and other traditional Web containers that support Servlet specifications).
In the latest Spring Boot 2.x release, support is also provided for Netty and non-blocking containers that integrate Servlet 3.1 +. Based on the runtime embedded container mechanism.
Developers only need to use one line of java-jar command to start the Web service.
VI. Automatic configuration
We also found that the core function of Spring Boot is automatic configuration.
We can see that Spring Boot does not need to specify a lot of XML configurations for HTTP requests and responses as it did with Spring MVC before.
In fact, the running process of Spring Boot also depends on Spring MVC, but it sets default values for various configuration items that need to be specified by developers and is built into the runtime environment, for example, the default server port is 8080. If we do not need to customize these configuration items, we can adopt established development conventions without any processing. This is the convention over configuration (Convention over Configuration) design concept advocated by Spring Boot.
VII. Built-in monitoring mechanism
In addition, compared with the traditional Spring framework, one of the highlights of Spring Boot is the introduction of a built-in monitoring mechanism, which is realized through Actuator components (including memory information, JVM information, garbage collection information, etc.). Based on the Actuator component, on the one hand, we can view the application details including automatic configuration, and on the other hand, we can monitor the runtime health of the application in real time.
As you can see, the above features of Spring Boot actually simplify the switching process of Web applications from multiple dimensions, including coding, configuration, deployment, and monitoring.
8. Spring Cloud (Netflix) and Micro Service Architecture
Spring Cloud is built on top of Spring Boot, and its overall architecture diagram is as follows:
The completeness of technical components is the main advantage of Spring Cloud framework, which integrates a large number of well-known micro-service development components in the industry. The core components of Spring Cloud are shown in the following figure
As you can see, based on the development convenience of Spring Boot, Spring Cloud cleverly simplifies the development process of micro-service system infrastructure. Spring Cloud includes service discovery registration, API gateway, configuration center, message bus, load balancing, fuses, data monitoring and so on.
9. Spring 5 and responsive programming
With the official release of Spring 5, we have ushered in a new period of development of responsive programming (Reactive Programming). Spring 5 embeds a variety of responsive components such as responsive data access related to data management, responsive message communication related to system integration, and responsive Web framework related to Web services, which greatly simplifies the development process and difficulty of responsive applications.
As you can see from the above figure, the left side of the above figure is the Spring WebFlux-based technology stack, and the right side is the Spring MVC-based technology stack. We know that traditional Spring MVC is built on Java EE's Servlet standard, which itself is blocking and synchronous, while Spring WebFlux is based on responsive flows, so it can be used to build asynchronous non-blocking services.
In Spring 5, Project Reactor is selected as the implementation library of responsive flow. Due to the nature of responsive programming, the operation of Spring WebFlux and Project Reactor needs to rely on containers such as Netty and Undertow that support asynchronous mechanisms. At the same time, we can also choose to use newer versions of Tomcat and Jetty as the running environment, because they support Servlet 3.1 of asynchronous Icano.
In Spring Boot-and Spring Cloud-based applications, Spring WebFlux and Spring MVC can be mixed.
At this point, I believe you have a deeper understanding of "what is the technical system of the Java Spring family". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.