Home > Java > javaTutorial > body text

Detailed graphic explanation of the advantages and core interfaces of Spring MVC

巴扎黑
Release: 2017-09-08 09:44:58
Original
2754 people have browsed it

This article mainly introduces the advantages and core interfaces of Spring MVC. The editor thinks it is quite good. I will share it with you now and give it as a reference. Let’s follow the editor to take a look

Choosing an excellent MVC framework for the development team is difficult. Choosing among many feasible options requires a high level of experience and level. One decision you make can impact your team for years to come. There are too many aspects to consider:

1. Simple and easy to use to improve development efficiency. Let a small part of the energy be focused on the framework and most of the energy on the business.

2. Excellent performance, this is the most eye-catching topic.

3. Try to use public frameworks (avoid using niche and private frameworks). Newly recruited developers have some technical accumulation in this area to reduce the impact of personnel turnover and re-adaptation.

If you are still worried about this incident, this article is best for you. Choose Spring MVC.

Spring MVC is currently the best MVC framework. Since the release of Spring 2.5, its ease of use has been greatly improved due to its support for annotation configuration. Spring 3.0 is more complete and surpasses Struts 2. Now more and more development teams choose Spring MVC.

Struts2 is also a very excellent MVC architecture, with many advantages, such as good structure, interceptor ideas, and rich functions. But what I want to talk about here is the disadvantage. Struts2 uses value stacks, OGNL expressions, struts2 tag libraries, etc., which will cause the performance of the application to decrease. You should avoid using these functions. Struts2's multi-layer interceptors and multi-instance actions perform very well.

Advantages of Spring3 MVC:

1. Spring3 MVC is easy to use and has low learning cost. It is less difficult to learn than Struts2, and Struts2 has too many redundant functions that cannot be used. Haha, of course this is not the deciding factor.

2. Spring3 MVC makes it easy to write programs with excellent performance. Struts2 must be careful in order to write programs with excellent performance (referring to the MVC part)

3. The flexibility of Spring3 MVC You can't imagine it. The scalability of the Spring framework is well-known. Of course, Spring3 MVC will not lag behind, and you will not feel any restrictions due to the use of the MVC framework.

The many advantages of Struts2:

#1. The old and well-known framework has accumulated a large number of user groups since Struts1. Rich technical documentation.

2. Other aspects are slightly... (Haha, isn’t it unfair?)

Spring’s official download URL is: http://www.springsource.org/download (used in this article Yes Spring version 3.0.5)

2. Core classes and interfaces:

Let’s first take a look at several important interfaces and classes. It doesn’t matter if you don’t know what they do now, just get familiar with them first and lay a foundation for getting to know them in the future.

DispatcherServlet -- Front controller

##HandlerMapping interface -- Processing request mapping

Implementation class of the HandlerMapping interface:

SimpleUrlHandlerMapping Maps a URL to the Controller through the configuration file

DefaultAnnotationHandlerMapping Maps a URL to the Controller class through the annotation

HandlerAdapter interface -- Processing request mapping

The AnnotationMethodHandlerAdapter class maps a URL to the method of the Controller class through annotations

Controller interface -- Controller

Because we use the @Controller annotation, the class annotated with the @Controller annotation can serve as a controller (Action) responsibility,

so we did not use this interface.

HandlerInterceptor Interface--Interceptor

No picture, we implement this interface ourselves to complete the work of the interceptor.

Implementation class of ViewResolver interface

UrlBasedViewResolver class Hands over a view name to a View for processing through the configuration file

InternalResourceViewResolver class, such as The above class adds JSTL support

View interface

JstlView class

LocalResolver interface

Core flow chart:

The above is the detailed content of Detailed graphic explanation of the advantages and core interfaces of Spring MVC. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template