The understanding and comparison of spring MVC and Spring boot

Source: Internet
Author: User

What is Spring MVC?
(1) Spring MVC is a powerful and flexible modular web framework provided by spring. With dispatcher Servlets, Modelandview and View Resolver, it's easy to develop Web applications.
(2) SPRINGMVC is a Java-based, request-driven, lightweight web framework designed to decouple the Web layer by using a "request-response" model that enables good layering, differentiated responsibilities, and simplified web development from the engineering structure. With annotations, Spring MVC provides a development pattern that is almost pojo, making it easier to develop and test the controller. These controllers generally do not process requests directly, but instead delegate them to other beans in the spring context, which are injected into the controller through spring's dependency injection function.
(3) The core of the spring framework is the so-called dependency injection and control inversion. Completely decouple the dependencies between classes, and if a class depends on anything, it is an interface. As for how to implement this interface, this is not important. As soon as you get a class that implements this interface, you can easily inject the implementation class into the class that invokes the interface through an XML configuration file. This dependency between all classes is completely superseded by the configuration file.




Advantages of SPRINGMVC:
(1) Easy to use, low learning cost.
(2) It is easy to write programs with excellent performance.
(3) Flexibility, Spring MVC Framework is easy to expand


Disadvantages of Springmvc:
(1) Spring coupled with MVC's servlet API makes it difficult to run independently from the container
(2) Too much subdivision, low development efficiency
(3) Excessive pursuit of perfection, the risk of excessive design


The problem areas to solve are: Web application or service development--url routing, Session, template engine, static Web resources and so on.










Spring Boot introduces the concept of automatic configuration, making it easy to set up your project. Spring boot itself does not provide the core features and extensions of the spring framework, but is for rapid and agile development of a new generation of spring-based applications. That is, it is not a solution to replace spring, but rather a tool that works closely with the spring framework to enhance the spring developer experience. It also integrates a large number of commonly used third-party library configurations (such as Jackson, JDBC, Mongo, Redis, mail, and so on), and these third-party libraries in the Spring boot application are almost zero-configured out-of-the-box (Out-of-the-box), Most spring boot applications require very little configuration code, and developers can focus more on business logic. Spring boot is just the bearer and assists the developer in simplifying the project setup process. If you are hosting a Web project that uses spring MVC as the MVC framework, then the workflow and Springmvc are exactly the same, because this part of the work is done by spring MVC rather than spring Boot.


Core features of Spring boot:
(1) Independent operation of Spring project
Spring boot can run independently as a jar package, using: Java-jar Xx.jar to run the project successfully, or to run the main function in the main program of the application project;

(2) Embedded servlet container
The embedded container allows us to execute the main program running the project main function, and let the project run quickly;

(3) Provide starter simplified Manen configuration
Spring Boot provides a range of starter Pom to simplify our maven dependency

(4) Automatic configuration Spring
Spring boot automatically configures the bean for the jar package class based on the Jar/class of the classpath in our project, which greatly simplifies our configuration. Of course, this is just the most used scenario that spring takes into account, and in some special cases, we also need to customize the automatic configuration;


(5) Application monitoring
Spring boot provides monitoring of the runtime's projects based on HTTP, SSH, and telnet;



Springboot to solve the problem:
1. How to streamline the configuration, how to make coding, deployment, monitoring easy;
2. How to easily integrate the spring ecosystem with other tool chains


Advantages:
For beginners, there is no threshold, as long as the novice who understands maven[] will look at the document to start a new project;
For the master, change the configuration is divided into minutes. In addition, the Fat jar is packaged in a way that makes deployment elegant.


Disadvantages:
There is a huge learning curve behind the simple. Getting started is easy, but without a complete learning of spring's system, you face a problem with a crazy look. Without some experience, there is no knowing what springboot does automatically.










The difference between SPINGMVC and springboot:
Contact:
Spring initially decoupled the application components with "Factory mode" (DI) and "proxy mode" (AOP). In this mode, an MVC framework (some Spring decoupled components) was developed to develop a Web application (SPRINGMVC). Later found every development to make a lot of reliance, write a lot of boilerplate code, so that the code is bloated and troublesome, so the wise predecessors organized a few lazy integration package (starter), this set is Spring Boot.


Difference:
Spring MVC is a Servlet-based MVC framework that primarily addresses WEB development issues But a comparison of the configuration of spring, while the spring boot principle is that the contract is better than the configuration, which greatly simplifies the spring configuration process.

The understanding and comparison of spring MVC and Spring boot

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.