Spring MVC 和 Spring Core 之间的区别

Difference between Spring MVC and Spring Core

Spring MVC 和 Struts MVC 是否相似?在 Spring MVC 中,它只是像 struts MVC 那样的表示层吗? Spring 核心是否用于 Spring MVC。您能否详细说明如何在 Spring MVC 中使用 Spring 核心。

这些都是很宽泛的问题,我会尽量用简单的术语来表达。

Does Spring core is used in Spring MVC? How Spring Core is used in Spring MVC?

是的,Spring MVC 使用 Spring 核心。首先,Spring 核心是一个 IOC 容器,它将依赖项注入各种 bean 类(比如你的控制器 类、服务 类 等)。因此,spring-mvc 利用 IOC 容器(spring-核心)的强大功能来设置 Web 框架组件,例如 WebApplicationContext 和 resolving/creating ViewResolver 对象等..

我建议您查看 here 以详细了解 spring 模块如何相互协作。

Are Spring MVC and Struts MVC are alike? and in Spring MVC is it only presentation layer like struts MVC?

它们几乎没有相似之处,比如它们遵循 FrontController 模式,即 Spring 使用 DispatcherServlet 而 Struts 使用 ActionServlet。但是 spring 通过在 Web 应用程序中使用各种组件(如适配器、处理程序等)提供了更多的配置,例如,您可以轻松地配置哪些内容需要来自控制器 consumed/produced。 您可以在 this 上查看有关这两个框架之间差异的详细说明。