Understand the difference between Spring Spring MVC and Spring Boot at a glance

1. Concept

1、Spring

Spring is an open source container framework that can take over the components of the web layer, business layer, dao layer, and persistence layer, and can configure various beans and maintain the relationship between beans and beans. Its core is inversion of control (IOC) and aspect-oriented (AOP), which is simply a layered lightweight open source framework.

2、SpringMVC

Spring MVC is a follow-up product of SpringFrameWork and has been integrated into Spring Web Flow. SpringMVC is a web layer mvc framework, used to replace servlet (processing|response request, obtain form parameters, form verification, etc. SpringMVC is an open source framework of MVC, SpringMVC=struts2+spring, springMVC is equivalent to Struts2 plus Spring Integration.

3、SpringBoot

Springboot is a microservice framework that continues the core ideas of the spring framework IOC and AOP, and simplifies application development and deployment. Spring Boot appeared to simplify the creation, running, debugging, deployment, etc. of Spring applications. Using it, you can focus on the development of Spring applications without paying too much attention to XML configuration. A bunch of dependency packages are provided, and the dependency problem has been solved in accordance with usage habits —> Habits are greater than conventions. Project case www.fhadmin.org

2. Principle and structure

1. The principle and composition of Spring

To simplify our development work, Spring encapsulates a series of out-of-the-box component function modules, including: Spring JDBC, Spring MVC, Spring Security, Spring AOP, Spring ORM, Spring Test, etc. The following figure: a
Insert picture description here
simplified understanding diagram:
Insert picture description here
2, the principle and composition of SpringMVC

As can be seen from the above figure: SpringMVC is a functional module (SpringWebMVC) in SpringWeb. A technical framework implementation of MVC mode specially used to develop SpringWeb projects.
The principle is as follows:
Insert picture description here
MVC: Model (model), VIew (view), Controller (controller); we know the MVC architecture from the beginning of contact and learning javaWeb development, such as Sturts1, Sturts2 and so on.

3. Principles and characteristics of SpringBoot

Spring Boot is basically an extension of the Spring framework. It eliminates the XML configuration required to set up Spring applications, paving the way for a faster and more efficient development ecosystem.

Some features in Spring Boot:

  1. Create an independent spring application.

  2. Embed Tomcat, JettyUndertow and do not need to deploy them.

  3. "Starters" poms are provided to simplify Maven configuration.

  4. Automatically configure spring applications as much as possible.

  5. Provide production indicators, robust checks and external configuration.

  6. There are absolutely no code generation and XML configuration requirements.

The composition and structure are as follows:
Insert picture description here
It can be seen from the figure that SpringBoot includes the core (IOC) and (AOP) of Spring; and encapsulates some extensions, such as Statuser:
Insert picture description here

Three, difference and summary

1. Simply understand: Spring includes SpringMVC, and SpringBoot includes Spring or an extension based on Spring.

Insert picture description here
2. The relationship is roughly like this:

spring mvc < spring < springboot

3. Some advantages of Spring Boot compared to Spring include:

  1. Provide embedded container support

  2. Use the command java -jar to run the jar independently

  3. When deploying in an external container, you can choose to exclude dependencies to avoid potential jar conflicts

  4. Flexible options for specifying configuration files during deployment

  5. Random port generation for integration testing

4 Conclusion

Spring Boot is just an extension of Spring itself, making development, testing and deployment more convenient.


Guess you like

Origin blog.51cto.com/14622073/2536453