3

I am trying to configure Spring Data Rest to have an insensitive path matching for the repositories. So "/user" and "/User" should both be acceptable and lead to the user repository.

I have tried to configure it like this (as proposed in https://jira.spring.io/browse/SPR-13286) without success.

@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        AntPathMatcher matcher = new AntPathMatcher();
        matcher.setCaseSensitive(false);
        configurer.setPathMatcher(matcher);
    }
}

I'm using the 2.4.0.RELEASE of Spring Data Rest.

Agraphie
  • 33
  • 2
  • 7
  • Try: http://stackoverflow.com/questions/4150039/how-can-i-have-case-insensitive-urls-in-spring-mvc-with-annotated-mappings – James Jithin Sep 10 '15 at 13:26
  • Thanks for your reply! But I already tried that and it doesn't work... – Agraphie Sep 10 '15 at 15:42
  • Have you tried enabling Spring debug logging to see if the configuration is applied? – James Jithin Sep 10 '15 at 15:45
  • Yes, while the servlet is starting up I get a log from this class, so it gets picked up – Agraphie Sep 10 '15 at 16:28
  • I tried with your configuration and it works fine on my spring-web application. Might be an issue with spring-boot. I have faced such weird issues with spring-boot and moved project to normal spring-web and things are better. Only thing what I miss is the boot banner. :D – James Jithin Sep 11 '15 at 03:35
  • But are you using Sring Data Rest with repositories as RestRessource or are you using normal Spring Web with a controller you wrote yourself? – Agraphie Sep 11 '15 at 05:52
  • That matters. I am using spring-data and spring-rest separately. – James Jithin Sep 11 '15 at 05:56
  • So you are using Spring Rest with annotated repositories and for that the configuration above is working? – Agraphie Sep 11 '15 at 06:22
  • Yup, I have RestControllers which fetches value from Repositories. – James Jithin Sep 11 '15 at 06:25

0 Answers0