Prior to Spring 3.1, type and method-level request mappings were examined in two separate stages — acontroller was selected first by theDefaultAnnotationHandlerMappingand the actual method toinvoke was narrowed down second by theAnnotationMethodHandlerAdapter.
3.1之前,根据url映射到方法需要经过两步骤1,根据 DefaultAnnotationHandlerMapping 找到controller, 2, 根据 AnnotationMethodHandlerAdapter. 找到method
With the new support classes in Spring 3.1, theRequestMappingHandlerMappingis the only placewhere a decision is made about which method should process the request
3.1之后只有一步,RequestMappingHandlerMapping,是唯一一个地方决定哪个方法处理传过来的请求
/hotels/{hotel}/* has 1 URI variable and 1 wild card and is considered more specific than/hotels/{hotel}/**which as 1 URI variable and 2 wild cards.
If two patterns have the same count, the one that is longer is considered more specific. For example/foo/bar* is longer and considered more specific than/foo/*.
When two patterns have the same count and length, the pattern with fewer wild cards is consideredmore specific. For example/hotels/{hotel}is more specific than/hotels/*.
/hotels/{hotel} (特殊)
/hotels/*
• The default mapping pattern /**is less specific than any other pattern.For example/api/{a}/
{b}/{c} is more specific.
/**
/api/{a}/{b}/{c}(特殊)
• A prefix patternsuch as /public/** is less specific than any other pattern that doesn’t contain
double wildcards. For example/public/path3/{a}/{b}/{c}is more
specific.
/public/path3/{a}/{b}/{c}(特殊 specific)
/public/**
For the full details seeAntPatternComparatorinAntPathMatcher