#72 - Improved mapping discovery in AnnotationMappingDiscoverer.
AnnotationMappingDiscoverer now returns a polished mapping in case the type mapping consists of a plain slash only.
This commit is contained in:
@@ -93,7 +93,7 @@ public class AnnotationMappingDiscoverer implements MappingDiscoverer {
|
||||
return typeMapping;
|
||||
}
|
||||
|
||||
return typeMapping == null ? mapping[0] : typeMapping + mapping[0];
|
||||
return typeMapping == null || "/".equals(typeMapping) ? mapping[0] : typeMapping + mapping[0];
|
||||
}
|
||||
|
||||
private String[] getMappingFrom(Annotation annotation) {
|
||||
|
||||
@@ -60,6 +60,13 @@ public class AnnotationMappingDiscovererUnitTest {
|
||||
assertThat(discoverer.getMapping(method), is("/method"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolvesMethodLevelMappingWithSlashRootMapping() throws Exception {
|
||||
|
||||
Method method = SlashRootMapping.class.getMethod("method");
|
||||
assertThat(discoverer.getMapping(method), is("/method"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #46
|
||||
*/
|
||||
@@ -85,4 +92,11 @@ public class AnnotationMappingDiscovererUnitTest {
|
||||
@RequestMapping("/method")
|
||||
void method();
|
||||
}
|
||||
|
||||
@RequestMapping("/")
|
||||
interface SlashRootMapping {
|
||||
|
||||
@RequestMapping("/method")
|
||||
void method();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user