美文网首页
springboot 配置 springmvc 自动匹配.act

springboot 配置 springmvc 自动匹配.act

作者: 長得太帥忚四種檌 | 来源:发表于2020-04-03 09:58 被阅读0次

    添加一个配置类
    代码如下:

    @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;
        }
    }
    
    
    

    相关文章

      网友评论

          本文标题:springboot 配置 springmvc 自动匹配.act

          本文链接:https://www.haomeiwen.com/subject/weicphtx.html