Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Spring Cloud correctly? [above]

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

How to deliver software faster and release new features to users every week, every day, or even every hour? How to enable new employees to deploy code after entering the workforce? How to ensure quality at such a fast pace? Quickly, the main challenge facing our application development is that the faster the delivery, the more closely we can collect user feedback, thus more effectively meeting the needs of users.

Microservices, DevOps and cloud computing are the three major weapons for the industry to deal with the "fast" challenge, but none of them can be easily played with. Micro services not only bring benefits, but also introduce a lot of complexity; DevOps not only requires adjustments to team culture, organizational structure and R & D process, but also puts forward new requirements for application development; virtual machines, containers, mirrors and other new technologies need to be learned, can we quickly cross the cloud computing technology stack?

Spring Cloud, which will help us bridge the gap between application development and micro services, DevOps, cloud computing, let us easily embrace cloud micro services, but do you know how it is? Do you have a comprehensive understanding of it? Do you know how to use it correctly? New concepts and technologies emerge in an endless stream, which makes people foggy. Do you want to get a clearer understanding of them? Sharpen a knife without mistakenly chopping firewood. Take a quick look at the series of articles written by "IT veteran". You will gain the following knowledge:

The relationship between Micro Services, DevOps and Cloud Computing the Design principles of Spring Boot Spring Boot integrates which commonly used suites Spring Cloud microservices family buckets have which Spring Cloud supports DevOpsSpring Cloud and how to adapt to cloud infrastructure Spring Cloud fill-in application development model 1. The relationship among Micro Services, DevOps and Cloud Computing

With the accelerating speed of Internet restructuring in various industries, what new challenges have we encountered in application development? Fast, the martial arts in the world can only be fast, and the speed of application development is getting faster and faster. The faster the software development process runs, the faster companies can deliver software and collect user feedback more closely, so as to meet user needs more effectively, create better products, and build strong competitiveness, but:

How do you release new features to customers every week, every day, or even every hour? How do you get new employees to deploy code on their first day on the job or even during an interview? After the code is deployed, how can you be sure that the application is running properly and fall asleep?

These are the main challenges facing our application development. Micro services, DevOps and cloud computing are the three magic weapons for the industry to deal with this challenge:

Micro-service: the complexity and scale of Internet business are growing rapidly, single applications are difficult to meet this development needs, the application is divided into independent micro-services, each micro-service can well complete a small task and break it into pieces. Each microservice can be developed with the most appropriate technology and language, created and managed by a small team, and has a low cost of communication with each other, thus achieving fast iteration. DevOps: micro service solves the problems of large scale of a single application, slow iteration speed, difficult to expand and change, and improves the speed of application development. However, the efficiency of the overall R & D process still needs to be improved, and the traditional function matrix R & D method is not suitable. It is necessary to use the product as a clue to break down the gap between different responsibility teams, and the integration of development, operation and maintenance arises at the historic moment to achieve continuous integration and continuous delivery. Cloud computing: micro services focus on the development period of software, cloud computing focuses on the running period of software, and DevOps is the connection between development period and operation period. The visit volume of Internet business is massive, and there are peaks and troughs, which requires applications to be flexible and scalable, which requires that basic resources can be created and destroyed automatically, which leads to cloud computing technologies such as virtual machines and containers.

None of the above three treasures can be easily manipulated, so let's take a look at them separately to see what problems or difficulties we will encounter in using them:

First of all, the application architecture has evolved from "monolithic" to "micro-services". What difficulties will we encounter in embracing "micro-services"? Everything has two sides, and "microservice" is no exception. It not only brings some benefits, but also introduces some complexity. Compared with monolithic architecture, micro-service is more conducive to rapid delivery in terms of iteration speed, deployment frequency, system performance, system scalability, diversity of technology stack, etc. However, there are many new challenges in architecture complexity, deployment difficulty, operation and maintenance difficulty, problem location, management cost and so on, so how can we really embrace "micro-service"? Furthermore, DevOps, the integration of development, operation and maintenance, on this basis to achieve more efficient continuous integration and continuous delivery. In addition to putting forward new requirements for corporate culture, organizational structure and process system, DevOps also requires us to make new adjustments in application development. Is the application standardized enough? Can the deployment pipeline be applied? Is it possible to deploy with one click and so on? Finally, cloud computing, which is a brand new IT infrastructure, allows us to use resources such as computing, storage and networking in the same way as water and electricity. Virtual machines, containers, mirroring and other new technologies need us to be familiar with and master, can we all quickly cross the technology stack of cloud computing? Can our applications migrate to the cloud quickly? How to make full use of the characteristics of cloud computing to make applications more flexible are new challenges that we will face and solve. 2. The relationship among Spring, Spring Boot and Spring Cloud

Now that we have a preliminary understanding of what problems we have encountered, let's take a look at how Spring Cloud helps us meet these challenges. What changes will it bring to application development? The development of our human civilization is mainly reflected in the division of labor and cooperation, just as after hydropower has become infrastructure, each household will not produce water and electricity on its own, and the development of technology is also in line with this trend. Cloud computing is to bring some general and standard technologies into the infrastructure category, so that we can focus on the business area and improve the efficiency of delivery through division of labor and cooperation. Spring Cloud also follows the above rules and does a lot of auxiliary work for our application development from different dimensions, making application development easier.

Spring has existed as an application development framework for many years. With the continuous development and enrichment of JAVA development technology, the volume of Spring becomes larger and larger, and the configuration becomes more and more complex. Especially with the emergence of new technologies such as cloud computing and micro services, Spring Boot and Spring Cloud emerge as the times require. New concepts are easy to make people confused. It is necessary for us to clarify the relationship between them:

2.1 Spring

Spring Framework, an open source Java/Java EE full-function stack application development framework, includes mainstream technical frameworks such as presentation layer, domain layer, data layer and so on:

1) Core container (Core Container)

Spring-Core: core utility class, Spring other modules heavily use Spring-Core;Spring-Beans:Spring to define Bean support; Spring-Context: runtime Spring container; Spring-Context-Support:Spring container integration support for third-party packages; Spring-Expression: use expression language to query and manipulate objects at run time

2) AOP

Spring-AOP: agent-based AOP support; Spring-Aspects: AspectJ-based AOP support

3) message (Messaging)

Spring-Messaging: support for messaging architectures and protocols.

4) Web

Spring-Web: provides basic Web integration capabilities, provides Spring containers in Web projects; Spring-WebMVC: provides Servlet-based Spring MVC;Spring-WebSocket: provides WebSocket functionality; Spring-WebMVC-Portlet: provides Portlet environment support

5) data access / integration (Data Access/Integration)

Spring-JDBC: provides support for accessing databases through JDBC; Spring-TX: provides programmatic and declarative transaction support; Spring-ORM: provides support for object / relational mapping technology; Spring-OXM: provides support for object / XML mapping technology; Spring-JMS: provides support for JMS

In addition, a huge ecological circle has been formed around Spring Framework, including Spring Data, Spring Batch, Spring Security, Spring Integration, Spring AMQP, Spring Mobile, Spring for Android, Spring Web Flow, Spring Shell and other top sub-projects. Through reuse, developers can quickly develop business applications.

2.2 Spring Boot

Spring Boot makes a simple package for Spring, simplifies the development of Spring applications, and can build a simple application by writing a small amount of code. It adheres to the concept that the default agreement is greater than the configuration, simplifies the original complex configuration files, provides out-of-the-box settings for Spring and third-party libraries, and provides a set of scaffolding for the rapid development of individual micro-services, making it more convenient and efficient for us to get started and develop.

2.3 Spring Cloud

A framework of distributed service governance provides us with suites such as configuration center, service registration discovery, circuit breaker, load balancing, micro-agent, message bus, data monitoring and so on. Spring Boot is the rapid configuration scaffolding of Spring. We can quickly develop individual micro-services based on Spring Boot. Spring Cloud is a micro-service development kit based on Spring Boot. Spring Boot focuses on the rapid development of individual micro-services, and Spring Cloud focuses on the global service governance framework.

Spring does not reinvent the wheel, it just combines the mature and tested service frameworks of various companies, shields the complex configuration and implementation principles through Spring Boot encapsulation, and finally provides developers with a set of distributed system development kits that are easy to understand, easy to deploy and easy to maintain. Micro-service is a service unit that can be independently deployed, horizontally expanded and accessed independently. Spring Cloud is the butler of these micro-services. The number of components under micro-service architecture will be very large, and Spring Cloud needs to provide various solutions to manage the whole ecology. Spring Boot can be used independently of Spring Cloud, but Spring Cloud cannot be used without Spring Boot. Their dependencies are as follows:

Spring-> Spring Boot > Spring Cloud3. What common components does Spring integrate?

Since the release of version 1.0 in 2004, Spring has evolved to version 5.x, which provides a strong support for application development in different periods. Now that we are facing the new challenges of microservices, DevOps and cloud computing, what kind of support will Spring Cloud, the new force of the Spring family, provide for us? To sum up, I think it can be divided into four categories:

In the construction of a single micro-service, it provides a set of application development framework, the main body is based on the ecological open source product Spring Framework. In horizontal dimension service integration, it integrates a large number of common components and micro-service buckets in the way of Starter, which can be used right out of the box, reducing the difficulty of developing micro-services, improving efficiency and avoiding repeated investment. In terms of vertical dimensional resource scheduling, it can be smoothly integrated with Cloud Foundry, Kubernetes, Docker, etc., making the cloud easier for applications, making resource scheduling more intelligent and efficient, and making applications more flexible. In the full connectivity of the R & D process, it can do some cooperation and optimization with DevOps-related systems, so that the application can pass through all R & D links more smoothly, making continuous integration and continuous delivery more efficient.

Next, we will expand each point to take a look. First, let's take a look at what common components it integrates:

Monitoring service class, including host monitoring (Vector), application monitoring (Actuator), etc.; storage service class, including relational database (MySQL), document database (MangoDB), memory database (Redis), etc.; message service class, including ActiveMQ, RocketMQ, Kafka, etc.; security service class, including OAuth3.0, JWT, etc.

The main value of this article is to help you sort out the knowledge framework related to Spring Cloud, that is, the global perspective or God perspective. With this framework, we can according to our own needs to find clues to find the relevant node information to study, so as not to fall into the details can not find the direction. Of course, considering that each of us has different work and study conditions and different problems we usually encounter, this article cannot cover the problems encountered by everyone. You are welcome to leave messages and ask questions, and you are also welcome to follow the exchange and interaction of "IT veterans". Thank you!

The index of other articles in this series is as follows:

How to use Spring Cloud correctly? [below] Please add a link description

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report