且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

EnableWebMvc注释的含义

更新时间:2022-05-22 15:15:23

当您使用的是Java code(而不是XML)来配置Spring应用程序, @EnableWebMvc 用于启用Spring MVC的。如果你不熟悉Spring的Java配置,this是开始的好地方。

When you're using Java code (as opposed to XML) to configure your Spring application, @EnableWebMvc is used to enable Spring MVC. If you're not already familiar with Spring's support for Java configuration, this is a good place to start.

@EnableWebMvc 等同于< MVC:注解驱动/> XML格式。它能够为使用 @RequestMapping 来传入请求映射到一定的方法 @Controller -annotated类的支持。你可以阅读有关它配置在默认情况下,如何详细信息自定义的配置reference文档。

@EnableWebMvc is equivalent to <mvc:annotation-driven /> in XML. It enables support for @Controller-annotated classes that use @RequestMapping to map incoming requests to a certain method. You can read detailed information about what it configures by default and how to customise the configuration in the reference documentation.