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 quickly build a frame Spring Boot

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article focuses on "how to quickly build a framework Spring Boot", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to quickly build a frame Spring Boot"!

I. brief introduction

1. What is it?

SpringBoot is a rapid development framework. Generally speaking, it is a set of quick configuration scaffolding for Spring.

Boot means "start" in Chinese, and Spring Boot, as its name implies, is the boot of Spring, which is used to start Spring.

Core:

Realize the Maven dependency through Maven inheritance

Integrate the third-party framework

Annotations are used completely, and annotations will be used to start SpringMVC after Spring3.0.

Embedded Http server-- create tomcat through Java

2. Why use SpringBoot?

Can help us quickly integrate third-party framework, fully use annotations, simplify XML configuration (convention is greater than configuration), embedded Http server (Tomcat, Jetty), default embedded Tomcat server. Finally, it is executed by the Java application (packed into a jar package).

3. Background?

Spring tedious configuration, jar package version dependence, in order to solve these two problems, spring boot came into being!

Second, the SpringBoot starts the built-in Tomcat, and the source code tracking is arranged by hand.

1. Source code tracking

-> EmbeddedWebApplicationContext.java:onRefresh ()-> createEmbeddedServletContainer ()

General process:

Call the constructor to determine whether it is a Web environment: prepareEnvironment (listeners,applicationArguments)

-- > get the specific implementation of ApplicationContext: createApplicationContext ()

-- > refreshContext (context) upward transformation calls onRefresh () in EmbeddedWebApplicationContext

-- > call createEmbeddedServletContainer to start and complete

Interview questions:

I. the difference between Spring Boot and Spring Cloud

SpringBoot is a rapid development framework that can help us quickly integrate third-party frameworks, fully adopt annotations, simplify XML configuration, and finally execute as Java applications.

It's a monomer.

SpringCloud is a complete micro-service solution framework at present, which is very powerful. Microservice communication is based on Http+Json (Restful style), lightweight data transmission.

It is a distributed service governance framework for integrated management of individual units, which can be understood as a whole of multiple units, and this whole provides a set of solutions to these multi-unit problems in the development process.

For example, SpringBoot is compared to the departments of a hospital, while SpringCloud is a hospital. The hospital is not only a simple superposition of departments, but also can solve problems for one department and coordinate other departments to solve problems.

Relationship:

SpringBoot realizes rapid development, and Web components integrate SpringMVC by default.

SpringCloud relies on SpringBoot to implement micro-services and uses SpringMVC to write micro-service interfaces.

Summary:

Spring boot can use development projects independently of Spring Cloud, but Spring Cloud can't do without Spring boot.

Implementation of micro-service development with SpringBoot+SpringCloud

Second, the difference between Spring Boot 1.x version and Spring Boot 2.x version

3. How does SprigBoot start SpingMVC?

1. Start the built-in Servlet Container (default Tomcat)

two。 Initialize Servlet,Filter

3. Initialize DispatcherServlet

At this point, I believe you have a deeper understanding of "how to quickly build a framework Spring Boot". 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.

Share To

Internet Technology

Wechat

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

12
Report