一.使用WebMvcConfigurer接口来扩展SpringMVC的功能
@Configuration public class MyMvcConfig implements WebMvcConfigurer{ }
1添加试图映射
@Configuration public class MyMvcConfig implements WebMvcConfigurer{ @Override public void addViewControllers(ViewControllerRegistry registry) { //浏览器mvctest请求去找success文件 registry.addViewController("/mvctest").setViewName("success"); } }