赞
踩
//@Configuration
//@EnableWebMvc //全面接管
//public class WebMvcConfig implements WebMvcConfigurer {
// @Override
// public void addViewControllers(ViewControllerRegistry registry) {
// // 浏览器发送/test , 就会跳转到test页面;
// //registry.addViewController("/test").setViewName("user/detail");
// }
//}
@Configuration public class WebMvcConfigurer extends WebMvcConfigurationSupport { /** * 发现如果继承了WebMvcConfigurationSupport,则在yml中配置的相关内容会失效。 需要重新指定静态资源 * * @param registry */ @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/**").addResourceLocations( "classpath:/static/"); registry.addResourceHandler("swagger-ui.html").addResourceLocations( "classpath:/META-INF/resources/"); registry.addResourceHandler("/webjars/**").addResourceLocations( "classpath:/META-INF/resources/webjars/"); super.addResourceHandlers(registry); } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。