对于最新的稳定版本,请使用 Spring Framework 7.0.6!spring-doc.cadn.net.cn

MVC 配置接口

在Java配置中,你可以实现WebMvcConfigurer接口,如下例所示:spring-doc.cadn.net.cn

@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {

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

	// Implement configuration methods...
}

在XML中,你可以检查<mvc:annotation-driven/>的属性和子元素。你可以查看Spring MVC XML模式或使用你的IDE的代码补全功能来发现可用的属性和子元素。spring-doc.cadn.net.cn