Comparison of the advantages and disadvantages of springmvc and springboot

origin xiaqo.com

In a recent project, I used springmvc to develop it.
However, the project is handed over to other colleagues, and will also be handed over to the customer for deployment in the future.
Found a troublesome problem.

First of all, I need to configure Tomcat, configure the port file, and configure the configuration to point to the external war package file.
When restarting Tomcat, there are various cache cleanups.
This makes deployment very troublesome.

Secondly, springmvc itself has many xml files to configure, such as the mvc part and the config part.
Once the configuration is complete, configuration work must also be done in web.xml.
Relatively speaking, it is very troublesome.

In addition to the above two points, there are:
Advantages of SpringMVC:
(1) Easy to use and low learning cost.
(2) It is easy to write programs with excellent performance.
(3) It is highly flexible and the Spring MVC framework is easy to expand.
Disadvantages of SpringMVC:
(1) Spring is coupled with the Servlet API of MVC, making it difficult to run independently from the container.
(2) It is too segmented and the development efficiency is low.
(3) Excessive pursuit of perfection and the danger of over-design. The problem areas to be solved are: website application or service development - URL routing, Session, template engine, static Web resources, etc.

Core functions of Spring Boot:
(1) Independently running Spring project
Spring Boot can be run independently in the form of a jar package. Use: java -jar xx.jar to successfully run the project, or run the main function in the main program of the application project;
(2) Embedded Servlet container
Embedded container allows us to execute the main function of the main program that runs the project, and allow the project to run quickly
(3) Provide starter to simplify Manen configuration
Spring Boot provides a series of starter pom to simplify our Maven dependencies
(4) Automatically configure Spring
Spring Boot will automatically configure Spring according to the requirements of our project. The jar package/class in the class path automatically configures beans for the classes in the jar package, which greatly simplifies our configuration. Of course, this is only the majority of usage scenarios that Spring considers. In some special cases, we also need to customize automatic configuration;
(5) Application monitoring
Spring Boot provides monitoring of runtime projects based on http, ssh, and telnet;

Problems to be solved by springboot:
1. How to streamline configuration; how to make coding, deployment, and monitoring simpler;
2. How to make it convenient Integrate the spring ecosystem with other tool chains;

Advantages:
1. For novices, there is no need for any threshold. As long as they understand Maven and can read the documentation, they can start a new project step by step;
2. For experts, changing the configuration is a matter of minutes. In addition, the packaging method of fat jar makes the deployment method elegant.
Disadvantages:
1. There is a huge learning curve behind the simplicity. It's easy to get started, but if you don't fully learn the spring system, you will be confused when you encounter problems. If you don't have some experience, you don't know what springboot does automatically.

The connection and difference between SpingMVC and SpringBoot:
Contact:
Spring initially used "factory mode" (DI) and "agent mode" (AOP) ) to decouple application components. According to this model, we built an MVC framework (some components decoupled with Spring) and used it to develop web applications (SpringMVC). Later, I found that every development requires a lot of dependencies and a lot of boilerplate code, which makes the code bloated and cumbersome, so smart predecessors compiled some lazy integration packages (starters), which is Spring Boot.
Difference:
Spring MVC is an MVC framework based on Servlet, which mainly solves the problems of WEB development but it is about the configuration comparison of Spring;
The principle of Spring boot is: convention is better than configuration, which can greatly simplify the spring configuration process.

Based on the above reasons, I think it is imperative to learn springboot.
In addition, front-end and back-end separation, distributed deployment, and clustered services are now popular. Springboot has become a must-learn thing.
————————————————
Copyright statement: This article is an original article by a CSDN blogger "ordinary netizen". Comply with the CC 4.0 BY-SA copyright agreement, please attach the original source link and this statement when reprinting.
Original link: https://blog.csdn.net/m0_67401055/article/details/124443397

Guess you like

Origin blog.csdn.net/2301_79354153/article/details/134781740