DATAREST-1540 - Improvements in HandlerMapping implementation for Spring 5.3.

We now use Spring's path prefix capabilities to apply Spring Data REST's base path to its mappings. This was previously implemented by tweaking the matching conditions.

We now also pick up Spring 5.3's PathPatternParser and apply that to the custom HandlerMapping implementations we register.

Moved DelegatingHandlerMapping into the configuration package to be able to keep it around in package scope.

Deprecated RepositoryRestConfiguration.getBaseUri() as we have only supported paths for quite a while now. Moved all client code to ….getBasePath() instead.
This commit is contained in:
Oliver Drotbohm
2020-07-01 18:26:28 +02:00
parent 8992e21175
commit d7f36b1180
11 changed files with 110 additions and 499 deletions

View File

@@ -21,11 +21,11 @@ import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
import org.springframework.data.rest.tests.mongodb.MongoDbRepositoryConfig;
import org.springframework.data.rest.webmvc.support.DelegatingHandlerMapping;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerExecutionChain;
import org.springframework.web.servlet.HandlerMapping;
/**
* Integration tests for {@link BasePathAwareHandlerMapping}.
@@ -36,7 +36,7 @@ import org.springframework.web.servlet.HandlerExecutionChain;
@ContextConfiguration(classes = MongoDbRepositoryConfig.class)
public class RepositoryRestHandlerMappingIntegrationTests extends AbstractControllerIntegrationTests {
@Autowired DelegatingHandlerMapping mapping;
@Autowired HandlerMapping mapping;
@Test // DATAREST-617
public void usesMethodsWithoutProducesClauseForGeneralJsonRequests() throws Exception {