Spring MVC Missing matrix variable

前端 未结 2 1565
萌比男神i
萌比男神i 2021-01-07 06:32

I\'m trying to add a matrix parameter (or matrix variable) to my Rest Controller using SpringMVC (from Spring boot 1.2.3.RELEASE) Here is my code :

@RestCont         


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-07 07:01

    In SpringBoot Application In order to enable Matrix variables you need to define below override code

    @Configuration
    public class WebConfig extends WebMvcConfigurerAdapter {
    
        @Override
        public void configurePathMatch(PathMatchConfigurer configurer) {
            UrlPathHelper urlPathHelper = new UrlPathHelper();
            urlPathHelper.setRemoveSemicolonContent(false);
            configurer.setUrlPathHelper(urlPathHelper);
        }
    }
    

    Otherwise, they’re disabled by default

提交回复
热议问题