添加一个配置类
代码如下:
@Configuration
public class WebMvcConfigurer extends WebMvcConfigurerAdapter {
@Override
public void configurePathMatch(PathMatchConfigurer pathMatchConfigurer) {
pathMatchConfigurer.setUseSuffixPatternMatch(false);
pathMatchConfigurer.setUseRegisteredSuffixPatternMatch(true);
}
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.favorPathExtension(false);
}
@Bean
public ServletRegistrationBean<DispatcherServlet> servletRegistrationBean(DispatcherServlet dispatcherServlet) {
ServletRegistrationBean<DispatcherServlet> bean = new ServletRegistrationBean<DispatcherServlet>(dispatcherServlet);
bean.addUrlMappings("*.action");
return bean;
}
}
网友评论