6

A fan who has worked for 7 years, he said that the Spring content was well prepared before the interview.

And all kinds of interview questions have also been brushed. As a result, during the interview, the interviewer asked: "Tell me about your understanding of Spring MVC".

This question can't be solved for him at once. It's the kind of suddenly who doesn't know how to organize the language, and finally failed the interview because the answers were confusing.

ok, for this question, let's take a look at the answers of ordinary people and experts.

Ordinary people:

Spring MVC it is an MVC framework.

Web applications can be developed using Spring MVC

Expert:

OK, I will answer this question in several ways.

First of all, Spring MVC is a module in the Spring Framework ecosystem. It is a web framework built on the basis of Servlet and designed using the MVC pattern.

The main purpose is to simplify the Web development method under the traditional Servlet+JSP mode.

Secondly, the overall architecture design of Spring MVC has enhanced and extended the MVC architecture pattern in Java Web, mainly in several aspects.

  1. The Controller controller in the traditional MVC framework is split and divided into the front-end controller DispatcherServlet and the back-end controller Controller.
  2. Split the Model model into the business layer Service and the data access layer Repository.
  3. In the view layer, different views can be supported, such as Freemark, velocity, JSP and so on.

Therefore, Spring MVC is naturally designed for the MVC pattern, so it will be more convenient and flexible to develop MVC applications.

The specific workflow of Spring MVC is that the browser request will first pass through the core controller DispatcherServlet in Spring MVC, which is responsible for distributing the request to the corresponding Controller.

After processing the business logic in the Controller, return to ModeAndView.

Then DispatcherServlet looks for one or more ViewResolver view resolvers, finds the view specified by ModeAndView, and displays the data to the client.

image-20220423220421552

The above is my understanding of Spring MVC.

Summarize

I have trained more than 3W Java architects, and I found that their understanding of technology is only at the use level,

There is no in-depth thinking about the underlying design of these technical frameworks, which led them to work 5 years later.

When you want to change the architecture, you lack top-level design capabilities and abstract thinking.

Friends who like my works remember to like and favorite.

If you have any work and study questions, you can send me a private message at any time. There are also Java interview materials and resume templates available for collection.

file

Copyright notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated. Please indicate the source for Mic带你学架构 !
If this article is helpful to you, please help to follow and like, your persistence is the driving force for my continuous creation. Welcome to follow the WeChat public account of the same name to get more technical dry goods!

跟着Mic学架构
810 声望1.1k 粉丝

《Spring Cloud Alibaba 微服务原理与实战》、《Java并发编程深度理解及实战》作者。 咕泡教育联合创始人,12年开发架构经验,对分布式微服务、高并发领域有非常丰富的实战经验。