Revise order of method declarations in WebFluxConfigurer
See gh-30678
This commit is contained in:
parent
b016f385e1
commit
3c9cfa8a0f
|
|
@ -52,31 +52,6 @@ public class DelegatingWebFluxConfiguration extends WebFluxConfigurationSupport
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void configureContentTypeResolver(RequestedContentTypeResolverBuilder builder) {
|
||||
this.configurers.configureContentTypeResolver(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addCorsMappings(CorsRegistry registry) {
|
||||
this.configurers.addCorsMappings(registry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configurePathMatching(PathMatchConfigurer configurer) {
|
||||
this.configurers.configurePathMatching(configurer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
this.configurers.addResourceHandlers(registry);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
|
||||
this.configurers.configureArgumentResolvers(configurer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureHttpMessageCodecs(ServerCodecConfigurer configurer) {
|
||||
this.configurers.configureHttpMessageCodecs(configurer);
|
||||
|
|
@ -100,9 +75,33 @@ public class DelegatingWebFluxConfiguration extends WebFluxConfigurationSupport
|
|||
}
|
||||
|
||||
@Override
|
||||
protected WebSocketService getWebSocketService() {
|
||||
WebSocketService service = this.configurers.getWebSocketService();
|
||||
return (service != null ? service : super.getWebSocketService());
|
||||
protected void addCorsMappings(CorsRegistry registry) {
|
||||
this.configurers.addCorsMappings(registry);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureBlockingExecution(BlockingExecutionConfigurer configurer) {
|
||||
this.configurers.configureBlockingExecution(configurer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureContentTypeResolver(RequestedContentTypeResolverBuilder builder) {
|
||||
this.configurers.configureContentTypeResolver(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configurePathMatching(PathMatchConfigurer configurer) {
|
||||
this.configurers.configurePathMatching(configurer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
|
||||
this.configurers.configureArgumentResolvers(configurer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
this.configurers.addResourceHandlers(registry);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -111,7 +110,9 @@ public class DelegatingWebFluxConfiguration extends WebFluxConfigurationSupport
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void configureBlockingExecution(BlockingExecutionConfigurer configurer) {
|
||||
this.configurers.configureBlockingExecution(configurer);
|
||||
protected WebSocketService getWebSocketService() {
|
||||
WebSocketService service = this.configurers.getWebSocketService();
|
||||
return (service != null ? service : super.getWebSocketService());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,53 +45,6 @@ import org.springframework.web.reactive.socket.server.WebSocketService;
|
|||
*/
|
||||
public interface WebFluxConfigurer {
|
||||
|
||||
/**
|
||||
* Configure how the content type requested for the response is resolved
|
||||
* when handling requests with annotated controllers.
|
||||
* @param builder for configuring the resolvers to use
|
||||
*/
|
||||
default void configureContentTypeResolver(RequestedContentTypeResolverBuilder builder) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure "global" cross-origin request processing. The configured CORS
|
||||
* mappings apply to annotated controllers, functional endpoints, and static
|
||||
* resources.
|
||||
* <p>Annotated controllers can further declare more fine-grained config via
|
||||
* {@link org.springframework.web.bind.annotation.CrossOrigin @CrossOrigin}.
|
||||
* In such cases "global" CORS configuration declared here is
|
||||
* {@link org.springframework.web.cors.CorsConfiguration#combine(CorsConfiguration) combined}
|
||||
* with local CORS configuration defined on a controller method.
|
||||
* @see CorsRegistry
|
||||
* @see CorsConfiguration#combine(CorsConfiguration)
|
||||
*/
|
||||
default void addCorsMappings(CorsRegistry registry) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure path matching options.
|
||||
* <p>The configured path matching options will be used for mapping to
|
||||
* annotated controllers and also
|
||||
* {@link #addResourceHandlers(ResourceHandlerRegistry) static resources}.
|
||||
* @param configurer the {@link PathMatchConfigurer} instance
|
||||
*/
|
||||
default void configurePathMatching(PathMatchConfigurer configurer) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add resource handlers for serving static resources.
|
||||
* @see ResourceHandlerRegistry
|
||||
*/
|
||||
default void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure resolvers for custom {@code @RequestMapping} method arguments.
|
||||
* @param configurer to configurer to use
|
||||
*/
|
||||
default void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the HTTP message readers and writers for reading from the
|
||||
* request body and for writing to the response body in annotated controllers
|
||||
|
|
@ -134,15 +87,50 @@ public interface WebFluxConfigurer {
|
|||
}
|
||||
|
||||
/**
|
||||
* Provide the {@link WebSocketService} to create
|
||||
* {@link org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter}
|
||||
* with. This can be used to configure server-specific properties through the
|
||||
* {@link org.springframework.web.reactive.socket.server.RequestUpgradeStrategy}.
|
||||
* @since 5.3
|
||||
* Configure "global" cross-origin request processing. The configured CORS
|
||||
* mappings apply to annotated controllers, functional endpoints, and static
|
||||
* resources.
|
||||
* <p>Annotated controllers can further declare more fine-grained config via
|
||||
* {@link org.springframework.web.bind.annotation.CrossOrigin @CrossOrigin}.
|
||||
* In such cases "global" CORS configuration declared here is
|
||||
* {@link org.springframework.web.cors.CorsConfiguration#combine(CorsConfiguration) combined}
|
||||
* with local CORS configuration defined on a controller method.
|
||||
* @see CorsRegistry
|
||||
* @see CorsConfiguration#combine(CorsConfiguration)
|
||||
*/
|
||||
@Nullable
|
||||
default WebSocketService getWebSocketService() {
|
||||
return null;
|
||||
default void addCorsMappings(CorsRegistry registry) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure settings related to blocking execution in WebFlux.
|
||||
* @since 6.1
|
||||
*/
|
||||
default void configureBlockingExecution(BlockingExecutionConfigurer configurer) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure how the content type requested for the response is resolved
|
||||
* when handling requests with annotated controllers.
|
||||
* @param builder for configuring the resolvers to use
|
||||
*/
|
||||
default void configureContentTypeResolver(RequestedContentTypeResolverBuilder builder) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure path matching options.
|
||||
* <p>The configured path matching options will be used for mapping to
|
||||
* annotated controllers and also
|
||||
* {@link #addResourceHandlers(ResourceHandlerRegistry) static resources}.
|
||||
* @param configurer the {@link PathMatchConfigurer} instance
|
||||
*/
|
||||
default void configurePathMatching(PathMatchConfigurer configurer) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure resolvers for custom {@code @RequestMapping} method arguments.
|
||||
* @param configurer to configurer to use
|
||||
*/
|
||||
default void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -156,10 +144,22 @@ public interface WebFluxConfigurer {
|
|||
}
|
||||
|
||||
/**
|
||||
* Configure settings related to blocking execution in WebFlux.
|
||||
* @since 6.1
|
||||
* Add resource handlers for serving static resources.
|
||||
* @see ResourceHandlerRegistry
|
||||
*/
|
||||
default void configureBlockingExecution(BlockingExecutionConfigurer configurer) {
|
||||
default void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide the {@link WebSocketService} to create
|
||||
* {@link org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter}
|
||||
* with. This can be used to configure server-specific properties through the
|
||||
* {@link org.springframework.web.reactive.socket.server.RequestUpgradeStrategy}.
|
||||
* @since 5.3
|
||||
*/
|
||||
@Nullable
|
||||
default WebSocketService getWebSocketService() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,37 +50,6 @@ public class WebFluxConfigurerComposite implements WebFluxConfigurer {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void configureContentTypeResolver(RequestedContentTypeResolverBuilder builder) {
|
||||
this.delegates.forEach(delegate -> delegate.configureContentTypeResolver(builder));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
this.delegates.forEach(delegate -> delegate.addCorsMappings(registry));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configurePathMatching(PathMatchConfigurer configurer) {
|
||||
this.delegates.forEach(delegate -> delegate.configurePathMatching(configurer));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
this.delegates.forEach(delegate -> delegate.addResourceHandlers(registry));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public WebSocketService getWebSocketService() {
|
||||
return createSingleBean(WebFluxConfigurer::getWebSocketService, WebSocketService.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
|
||||
this.delegates.forEach(delegate -> delegate.configureArgumentResolvers(configurer));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureHttpMessageCodecs(ServerCodecConfigurer configurer) {
|
||||
this.delegates.forEach(delegate -> delegate.configureHttpMessageCodecs(configurer));
|
||||
|
|
@ -102,8 +71,8 @@ public class WebFluxConfigurerComposite implements WebFluxConfigurer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void configureViewResolvers(ViewResolverRegistry registry) {
|
||||
this.delegates.forEach(delegate -> delegate.configureViewResolvers(registry));
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
this.delegates.forEach(delegate -> delegate.addCorsMappings(registry));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -111,6 +80,37 @@ public class WebFluxConfigurerComposite implements WebFluxConfigurer {
|
|||
this.delegates.forEach(delegate -> delegate.configureBlockingExecution(configurer));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureContentTypeResolver(RequestedContentTypeResolverBuilder builder) {
|
||||
this.delegates.forEach(delegate -> delegate.configureContentTypeResolver(builder));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configurePathMatching(PathMatchConfigurer configurer) {
|
||||
this.delegates.forEach(delegate -> delegate.configurePathMatching(configurer));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
|
||||
this.delegates.forEach(delegate -> delegate.configureArgumentResolvers(configurer));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureViewResolvers(ViewResolverRegistry registry) {
|
||||
this.delegates.forEach(delegate -> delegate.configureViewResolvers(registry));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
this.delegates.forEach(delegate -> delegate.addResourceHandlers(registry));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public WebSocketService getWebSocketService() {
|
||||
return createSingleBean(WebFluxConfigurer::getWebSocketService, WebSocketService.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private <T> T createSingleBean(Function<WebFluxConfigurer, T> factory, Class<T> beanType) {
|
||||
List<T> result = this.delegates.stream().map(factory).filter(Objects::nonNull).toList();
|
||||
|
|
|
|||
Loading…
Reference in New Issue