問題描述
我閱讀了有關(guān) @EnableWebMvc
的 javadoc.
I read javadoc about @EnableWebMvc
.
但是我不明白這個(gè)注解是什么意思?
But I don't understand what this annotation mean?
你能解釋清楚嗎?
推薦答案
當(dāng)你使用 Java 代碼(而不是 XML)來配置你的 Spring 應(yīng)用程序時(shí),@EnableWebMvc
用于啟用 SpringMVC.如果您還不熟悉 Spring 對(duì) Java 配置的支持,這是一個(gè)很好的起點(diǎn).
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
等價(jià)于 XML 中的 @RequestMapping
將傳入請(qǐng)求映射到特定方法的 @Controller
注釋類.您可以在 參考文檔.
@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.
這篇關(guān)于EnableWebMvc 注解含義的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!