I have a Spring boot application that exposes a REST API via Spring MVC.
When I run my application locally using the embedded tomcat I can access resources with a trailing slash on the end - e.g POST /resource/
However, when I deploy the war to a standalone tomcat instance, I get a 404 if I include the trailing slash on the URL, but a success without the trailing slash - e.g POST /resource.
The embedded tomcat works with or without the trailing slash.
My request mapping is
@RequestMapping(value = "/resource", method = RequestMethod.POST)
I've tried all sorts of configuration options including
@Override
public void configurePathMatch(PathMatchConfigurer matcher) {
matcher.setUseRegisteredSuffixPatternMatch(true);
matcher.setUseTrailingSlashMatch(true);
}
The only difference I can see is the embedded tomcat is v8 and the standalone is v7. Both running the exact same sourcecode but behaving differently.
Can anyone advise on how to correct this issue?
Thanks