Skip to content

Instantly share code, notes, and snippets.

@xtea
Created June 26, 2015 06:01
Show Gist options
  • Save xtea/a29626a4f59ef14e58b8 to your computer and use it in GitHub Desktop.
Save xtea/a29626a4f59ef14e58b8 to your computer and use it in GitHub Desktop.
SpringMVC会自动为一个Conctroler的URL加上 .* 和 /
/**
* Add URLs and/or URL patterns for the given path.
* @param urls the Set of URLs for the current bean
* @param path the currently introspected path
*/
protected void addUrlsForPath(Set<String> urls, String path) {
urls.add(path);
if (this.useDefaultSuffixPattern && path.indexOf('.') == -1 && !path.endsWith("/")) {
urls.add(path + ".*");
urls.add(path + "/");
}
}
@xtea
Copy link
Author

xtea commented Jun 26, 2015

如果不需要这个额外的操作可以将 DefaultAnnotationHandlerMapping.java 的属性:

useDefaultSuffixPattern = false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment