MVC Config API

在 Java 配置中,您可以实现 WebMvcConfigurer 接口,如下例所示:

In Java configuration, you can implement the WebMvcConfigurer interface, as the following example shows:

  • Java

  • Kotlin

@Configuration
public class WebConfiguration implements WebMvcConfigurer {

	// Implement configuration methods...
}
@Configuration
class WebConfiguration : WebMvcConfigurer {

	// Implement configuration methods...
}

在 XML 中,您可以检查 <mvc:annotation-driven/> 的属性和子元素。您可以查看 Spring MVC XML schema 或使用 IDE 的代码完成功能来了解可用的属性和子元素。

In XML, you can check attributes and sub-elements of <mvc:annotation-driven/>. You can view the Spring MVC XML schema or use the code completion feature of your IDE to discover what attributes and sub-elements are available.