Spring MVC (3.0) considers URLs with and without trailing slashes as the same URL.
For example:
http://www.example.org/data/something = http:
Based on SEO, I think it is important to make a distinction.
If the URL that finished in the trailing slash exist, is indexed in the search engines and there are links on Internet, a permanent redirection (301) is required as Uddhav Kambli says. The standard redirection (302) will be better than having a duplicated URL, but is not good enough.
However, if the URL never existed, it is not indexed on Internet and there are no external links, the URL does not exist. Therefore a 404, page not found, is a better fit.
WEB-INF/urlrewrite.xml
Remove trailing slash
^(.+)/$
404
null
And in order to complete the configuration ...
add to WEB-INF/web.xml
UrlRewriteFilter
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
confPath
/WEB-INF/urlrewrite.xml
UrlRewriteFilter
/*
REQUEST
Maven
org.tuckey
urlrewritefilter
4.0.3