Introduction to Spring Boot

1 Introduction

SpringBoot was originally designed based on Spring4.0, a framework provided by Pivotal.

History of SpringBoot development:

  • In 2003, Rod Johnson established Interface company, the product is SpringFramework
  • In 2004, the Spring framework was open source, and the company changed its name to Spring Source
  • In 2008, the acquisition of Apache Servlet and Tomcat laid the foundation for SpringBoot's embedded web container , and the entire ecology is mastered by itself
  • In 2009, the company was acquired by VMWare for $460 million
  • After being acquired, Spring has successively acquired many excellent open source middleware, such as RabbitMQ, Redis
  • In 2013, VMWare, EMC, and General Electric jointly established Pivotal. From then on, Spring began to go all the way.
  • In 2014, launched SpringBoot1.0, based on Spring4.0 development
  • In 2015, Spring Cloud was launched
  • In 2018, Pivotal went public
  • In March 2018, SpringBoot2.0 was released and developed based on Spring5.0

Both SpringBoot and SpringCloud are open source, so how does Pivotal make money?

Microservice is a relatively new technology. Traditional enterprises will definitely have many difficulties in developing their business into a microservice model. Pivotal relies on providing technical services to support profits. Two-thirds of the world's top 500 companies have cooperative relationships with Pivotal .

SpringBoot inherits the original excellent features of the Spring framework, such as IOC, AOP, etc. It is not used to replace Spring solutions, but is closely integrated with the Spring framework, which further simplifies the entire construction and development process of Spring applications. Its design purpose is to simplify the initial construction and development process of Spring applications. How to simplify it? It is to make it easier for us to use by providing a default configuration method.

Let me explain in detail. If we have developed based on the SSM framework, we can understand that Spring needs to do a lot of xml file configuration when integrating SpringMVC and Mybatis. The same is true when integrating other frameworks or middleware. And then compare SpringBoot development, we can find that we only need to introduce maven dependencies of different Starters, and then we can develop out of the box. This is what SpringBoot does for us: providing a default configuration method makes it easier for us to use.

Draw a picture below to help understand: This is Spring's module structure

This is my understanding of SpringBoot

There is a well-known saying about SpringBoot that convention is greater than configuration . Using SpringBoot can greatly simplify the development model. It integrates a large number of commonly used third-party library configurations. All the common frameworks you want to integrate have corresponding component support, such as Redis, MongoDB, Dubbo, Kafka, ES , etc.

These third-party libraries in SpringBoot applications can be used almost out of the box with zero configuration. Most SpringBoot applications only require a very small amount of configuration code, allowing developers to focus more on business logic. In addition, by integrating a large number of frameworks, SpringBoot has solved the version conflicts of dependent packages and the instability of references.

explain:

  • Convention is greater than configuration: using the SSM development mode, if Spring wants to integrate Redis, it must configure beans in the xml file and configure properties for the beans.
  • Dependency package version conflict: We can directly import a specified version of the spring-boot-starter-web dependency, and then import jar packages related to web development that do not conflict

Summarize

  1. A framework to simplify Spring application development;
  2. A large integration build anything of the entire enterprise-level development technology stack;
  3. One-stop solution for J2EE development;

advantage

  • Quickly build a standalone Spring application;
  • Embedded Tomcat, Jetty or Undertow, no need to deploy WAR files;
  • Provide starter POMs to simplify Maven configuration and reduce problems caused by version conflicts;
  • Provide default configuration for Spring and third-party libraries, and you can also modify the default value to simplify the framework configuration;
  • Provides production-ready features such as metrics, health checks, and external configuration;
  • No need to configure XML, no code generation, out of the box;

2.Why SpringBoot

Before starting the description of this stage, first ask yourself a question. If I originally used the SSM development model, although SpringBoot does simplify the configuration of Spring development, will I really use SpringBoot because of this simplification?

My answer is no. First of all, I am already familiar with SSM development, and the cost of switching to SpringBoot development mode is too high. In fact, there are many contributors who provide handy SSM scaffolding that works out of the box. Moreover, SSM development is a single application, and I only need to do one integration.

So the SpringBoot mentioned above simplifies the development of Spring. This is just the most intuitive aspect, but it can make SpringBoot so popular, and what really makes it popular is the microservice development model, which is also a must-talk about SpringBoot. The reason for microservices. It can be said that Spring Cloud drove SpringBoot, and SpringBoot made SpringCloud .

The following picture describes the relationship between Spring, SpringBoot, and SpringCloud.

From the Google keyword search, we can also see that the popularity of SpringBoot and microservices are synchronized.

microservice

When it comes to microservices, we have to mention the evolution process of the application architecture. The following is a brief description of e-commerce as an example.

In traditional application development, all our modules are developed and maintained in one application, which is the ALL-IN-ONE development model. If it is an e-commerce application, then this application will include user modules, payment modules, order modules, commodity modules, and so on. If the number of users increases and the number of application visits increases, then the load balancing architecture will be used, as shown in the following figure:

However, with the increase in application volume and access volume, problems such as difficult maintenance of single applications and bottlenecks of individual modules have been exposed. For example, as the number of developers increases and hundreds of people maintain a project at the same time, code merging and project launch are big problems. Also, if during certain event periods, such as Double 11, the order module has the most traffic, and the product and user module visits may not be much different than usual, then it will cost more to deploy more single application servers. More hardware resources increase the cost. Therefore, the microservice architecture was born.

The figure below shows the microservice architecture, from left to right. Traffic enters from the left and passes through nodes, which may be the nodes of the order module or the nodes of the user module. They communicate with each other through remote calls. Up to the two rows on the far right, the rightmost is the persistent layer storage such as mysql, and the cache layer in front of it is the cache layer, such as Redis.

Continue to talk about SpringBoot. With the increase of traffic, the microservice architecture is imperative, or horizontal expansion of applications is imperative, so if I continue to develop in the original SSM development mode, I only need to integrate Spring once and integrate other frameworks. I need to integrate many times , then it is far less fast and convenient than SpringBoot, so Spring Cloud drives SpringBoot, and SpringBoot makes SpringCloud .

Guess you like

Origin blog.csdn.net/2301_76965813/article/details/130171610