Spring、SpringMVC和SpringBoot

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. The core is inversion of control (IOC) and aspect-oriented (AOP), which is simply a layered lightweight open source framework.

2、SpringMVC

Spring MVC belongs to the follow-up product of SpringFrameWork and has been integrated in Spring Web Flow. SpringMVC is a web layer mvc framework used to replace servlets (process | respond to requests, get form parameters, form validation, etc. SpringMVC is an MVC open source framework, SpringMVC = struts2 + spring, springMVC is equivalent to Struts2 plus Spring Integration.

3、SpringBoot

Springboot is a microservices framework that continues the core ideas of the spring framework, IOC and AOP, to simplify application development and deployment. Spring Boot appears to simplify the creation, operation, debugging, and deployment of Spring applications. Using it, you can focus on the development of Spring applications without paying too much attention to XML configuration. Provided a bunch of dependency packaging, and has solved the dependency problem according to the usage habits ---> habits are greater than the convention.

Second, the 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. As shown below:

 

 

Simplified understanding diagram:

 

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 an MVC pattern specifically for developing Spring Web projects. The principle is as follows:

 

 

MVC: Model (model), VIew (view), Controller (controller); we know this kind of architecture of MVC from the beginning and learning javaWeb development, such as early risers Sturts1, Sturts2, etc.

3. The principle and characteristics of Spring Boot

Spring BootIt is basically Springan extension of the framework, which eliminates the need to set up Springapplications XML配置, paving the way for a faster and more efficient development ecosystem.

Spring BootSome features in:

  1. Create standalone springapplications.
  2. Embedded TomcatJettyUndertow and there is no need to deploy them.
  3. Provide "starters" poms to simplify Mavenconfiguration
  4. Automatically configure springapps whenever possible .
  5. Provide production indicators, robust inspection and external configuration
  6. There are absolutely no code generation and XMLconfiguration requirements.

The composition and structure are as follows:

 

 

It can be seen from the figure that Spring Boot includes Spring's core (IOC) and (AOP); and encapsulates some extensions, such as Stater:

 

 

3. Differences and summary

1. Simple understanding: Spring includes Spring MVC, and Spring Boot includes Spring or is an extension based on Spring.

 

 

 

2. The relationship is probably like this:

spring mvc < spring < springboot

 

3、Spring BootSpringSome advantages of  comparison include:

  • Provide embedded container support
  • Run the jar independently using the command java -jar
  • When deploying in an external container, you can choose to exclude dependencies to avoid potential jar conflicts
  • Flexible configuration of configuration file options during deployment
  • Random port generation for integration testing

4 Conclusion

Spring BootIt is just Springan extension of itself, making development, testing and deployment more convenient.

 

Guess you like

Origin www.cnblogs.com/dd1992dd/p/12757492.html