Use Set (again) for enumerating MvcEndpoints

This reverts a change that I assume was orphaned from work in
progress to address #1353, but is no longer needed. Anyway
there is no reason to restrict MvcEndpoints to be unique by
path since they can declare their own @RequestMappings
(and if there are duplicates they will be detected when those
are scanned).

Fixes gh-1911
This commit is contained in:
Dave Syer
2014-11-12 15:45:44 +00:00
parent bc76c87d44
commit 90d25bd582
2 changed files with 19 additions and 16 deletions

View File

@@ -133,6 +133,21 @@ public class EndpointHandlerMappingTests {
nullValue());
}
@Test
public void duplicatePath() throws Exception {
TestMvcEndpoint endpoint = new TestMvcEndpoint(new TestEndpoint("/a"));
TestActionEndpoint other = new TestActionEndpoint(new TestEndpoint("/a"));
EndpointHandlerMapping mapping = new EndpointHandlerMapping(Arrays.asList(
endpoint, other));
mapping.setDisabled(true);
mapping.setApplicationContext(this.context);
mapping.afterPropertiesSet();
assertThat(mapping.getHandler(new MockHttpServletRequest("GET", "/a")),
nullValue());
assertThat(mapping.getHandler(new MockHttpServletRequest("POST", "/a")),
nullValue());
}
private static class TestEndpoint extends AbstractEndpoint<Object> {
public TestEndpoint(String path) {