From b9ef5416b9af95b8739e0b977e55310ef9eaed11 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Fri, 25 Sep 2020 21:36:18 +0100 Subject: [PATCH] Expose combine method in CorsConfiguration Closes gh-25716 --- .../web/reactive/config/CorsRegistration.java | 12 ++++++++++++ .../servlet/config/annotation/CorsRegistration.java | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistration.java b/spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistration.java index cbe72fb6368..d459eaef1e7 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistration.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistration.java @@ -134,6 +134,18 @@ public class CorsRegistration { return this; } + /** + * Apply the given {@code CorsConfiguration} to the one being configured via + * {@link CorsConfiguration#combine(CorsConfiguration)} which in turn has been + * initialized with {@link CorsConfiguration#applyPermitDefaultValues()}. + * @param other the configuration to apply + * @since 5.3 + */ + public CorsRegistration combine(CorsConfiguration other) { + this.config.combine(other); + return this; + } + protected String getPathPattern() { return this.pathPattern; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistration.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistration.java index 6a006387211..71542289803 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistration.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistration.java @@ -135,6 +135,18 @@ public class CorsRegistration { return this; } + /** + * Apply the given {@code CorsConfiguration} to the one being configured via + * {@link CorsConfiguration#combine(CorsConfiguration)} which in turn has been + * initialized with {@link CorsConfiguration#applyPermitDefaultValues()}. + * @param other the configuration to apply + * @since 5.3 + */ + public CorsRegistration combine(CorsConfiguration other) { + this.config.combine(other); + return this; + } + protected String getPathPattern() { return this.pathPattern; }