DATAREST-1543 - Deprecate RepositoryRestConfiguration.getCorsRegistry().

Slightly tweaked the configuration model to rather handle the CorsRegistry via RepositoryRestConfigurer.configureRepositoryRestConfiguration(…) rather than RepositoryRestConfiguration itself. That allows moving of Spring WebMVC as a dependency in the core module.

The original methods exposing access to the CorsRegistry are now still available in deprecated form to not break existing clients.

Follow-up ticket: DATAREST-1542.
This commit is contained in:
Oliver Drotbohm
2020-07-03 14:53:59 +02:00
parent 239a86cc2d
commit 9f62237dd3
9 changed files with 187 additions and 29 deletions

View File

@@ -51,9 +51,9 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
@Bean
RepositoryRestConfigurer repositoryRestConfigurer() {
return RepositoryRestConfigurer.withConfig(config -> {
return RepositoryRestConfigurer.withConfig((config, cors) -> {
config.getCorsRegistry().addMapping("/books/**") //
cors.addMapping("/books/**") //
.allowedMethods("GET", "PUT", "POST") //
.allowedOrigins("http://far.far.example");
});