Spring MVC @PathVariable with dot (.) is getting truncated

后端 未结 17 1343
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 06:00

This is continuation of question Spring MVC @PathVariable getting truncated

Spring forum states that it has fixed(3.2 version) as part of ContentNegotiationManager.

17条回答
  •  灰色年华
    2020-11-22 06:41

    Update for Spring 4: since 4.0.1 you can use PathMatchConfigurer (via your WebMvcConfigurer), e.g.

    @Configuration
    protected static class AllResources extends WebMvcConfigurerAdapter {
    
        @Override
        public void configurePathMatch(PathMatchConfigurer matcher) {
            matcher.setUseRegisteredSuffixPatternMatch(true);
        }
    
    }
    
    
    @Configuration
    public class WebConfig implements WebMvcConfigurer {
    
       @Override
       public void configurePathMatch(PathMatchConfigurer configurer) {
           configurer.setUseSuffixPatternMatch(false);
       }
    }
    

    In xml, it would be (https://jira.spring.io/browse/SPR-10163):

    
        [...]
        
    
    

提交回复
热议问题