SPR-5726: Unexpected @RequestMapping semantics when class-level and method-level mappings used together
This commit is contained in:
parent
266a65982d
commit
4025df1ef8
|
@ -62,6 +62,7 @@ import org.springframework.util.AntPathMatcher;
|
|||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.PathMatcher;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.support.BindingAwareModelMap;
|
||||
|
@ -502,7 +503,8 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator implemen
|
|||
}
|
||||
|
||||
private boolean isPathMatch(String methodLevelPattern, String lookupPath) {
|
||||
if (isPathMatchInternal(methodLevelPattern, lookupPath)) {
|
||||
if ((!hasTypeLevelMapping() || ObjectUtils.isEmpty(getTypeLevelMapping().value())) &&
|
||||
isPathMatchInternal(methodLevelPattern, lookupPath)) {
|
||||
return true;
|
||||
}
|
||||
if (hasTypeLevelMapping()) {
|
||||
|
|
|
@ -319,7 +319,7 @@ public class UriTemplateServletAnnotationControllerTests {
|
|||
writer.write("create");
|
||||
}
|
||||
|
||||
@RequestMapping(value = "{hotel}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/{hotel}", method = RequestMethod.GET)
|
||||
public void show(@PathVariable String hotel, Writer writer) throws IOException {
|
||||
writer.write("show-" + hotel);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue