The difference between spring and spring mvc and the introduction of their functions

  • 2021-01-22 05:08:12
  • OfStack

The Spring framework is like a family, with many derivatives such as boot, security, jpa, etc. But they are both based on Spring -- ioc and aop -- ioc provides a dependency injection container, aop, that addresses cross-section-oriented programming, and then builds on both to implement other advanced features that extend the product. Spring MVC is an MVC framework based on Servlet to solve the problems of WEB development, because Spring configuration is very complex, various XML, JavaConfig, hin are more cumbersome to deal with. In order to simplify the use of developers, Spring boot was creatively launched, convention over configuration, simplifying the configuration process of spring.

To put it more simply, Spring originally used the "factory mode" (DI) and the "broker mode" (AOP) to decouple application components. We found it very useful, so we developed an MVC framework (some components decoupled with Spring) in accordance with this model, and used to develop web applications (SpringMVC). Then I found that I write a lot of boilerplate code every time. In order to simplify the work flow, I developed some "lazy man integration package" (starter). This set is Spring Boot.

Spring The functions of MVC

Spring MVC provides a lightly coupled way to develop web applications.

Spring MVC is a module of Spring, which is a framework of web. With Dispatcher Servlet, ModelAndView and View Resolver, it is easy to develop web applications. The problem areas addressed are web application or service development -- URL routing, Session, template engines, static Web resources, and so on.

Spring The functions of Boot

Spring Boot realizes automatic configuration, which reduces the complexity of project construction.

While the Spring framework is known to require a lot of configuration, Spring and Boot introduce the concept of automatic configuration to make project setup easy. Spring Boot itself does not provide the core features and extensions of the Spring framework, but is intended for rapid and agile development of a new generation of applications based on the Spring framework. In other words, it is not intended as a replacement for Spring, but rather as a tool that integrates closely with the Spring framework to enhance the Spring developer experience. At the same time it integrates a large number of commonly used third party library configuration (such as Jackson, JDBC, Mongo, Redis, Mail, etc.), Spring Boot applications in these third party library can be almost zero configuration out of the box (out-of-the-box), most Spring Boot applications only need a very small amount of configuration code, developers can be more focused on business logic.

Spring Boot is just a carrier that will help you streamline the project setup process. If you are hosting an WEB project and use Spring MVC as the MVC framework, then the workflow is exactly the same as what you described above, because this part of the work is done by Spring MVC and not Spring Boot.

For users, after using Spring Boot, the project initialization method has changed, the configuration file has changed, and in addition, there is no need to install the container server such as Tomcat separately. maven hit jar package and run directly is a website, but your most core business logic implementation and business process implementation has not changed.

So, the simplest way to summarize it is this:

Spring is an "engine";

Spring MVC is an MVC framework based on Spring.

Spring Boot is a rapid development package based on Spring4 conditional registration.

conclusion

The above is this site to introduce spring boot and spring mvc difference and function introduction, I hope to help you, if you have any questions welcome to give me a message, this site will reply to you in time!


Related articles: