For now, if you use @RequestMapping, @GetMapping, @PostMapping, … you will see that if you accidentally added a trailing slash “/” in the URL, you will get a 404 HTTP error.
To handling this problem, we need to add a path matching configurer.
public void configurePathMatch(PathMatchConfigurer configurer){…}
@Override public void configurePathMatch(PathMatchConfigurer configurer){ configurer.setUseTrailingSlashMatch(true); }
To manipulate the URL, you can chain this configurer with setPathHelper(…)
, or setUrlPathHelper(…)
with your own implementation of PathMatcher
or UrlPathHelper
.