|
|
@ -18,8 +18,8 @@ package org.springframework.boot.autoconfigure.web.reactive;
|
|
|
|
|
|
|
|
|
|
|
|
import java.time.Duration;
|
|
|
|
import java.time.Duration;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
@ -46,7 +46,6 @@ import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Import;
|
|
|
|
import org.springframework.context.annotation.Import;
|
|
|
|
import org.springframework.core.Ordered;
|
|
|
|
import org.springframework.core.Ordered;
|
|
|
|
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
|
|
|
|
|
|
|
import org.springframework.core.convert.converter.Converter;
|
|
|
|
import org.springframework.core.convert.converter.Converter;
|
|
|
|
import org.springframework.core.convert.converter.GenericConverter;
|
|
|
|
import org.springframework.core.convert.converter.GenericConverter;
|
|
|
|
import org.springframework.format.Formatter;
|
|
|
|
import org.springframework.format.Formatter;
|
|
|
@ -115,43 +114,39 @@ public class WebFluxAutoConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
private final ListableBeanFactory beanFactory;
|
|
|
|
private final ListableBeanFactory beanFactory;
|
|
|
|
|
|
|
|
|
|
|
|
private final List<HandlerMethodArgumentResolver> argumentResolvers;
|
|
|
|
private final Stream<HandlerMethodArgumentResolver> argumentResolvers;
|
|
|
|
|
|
|
|
|
|
|
|
private final List<CodecCustomizer> codecCustomizers;
|
|
|
|
private final Stream<CodecCustomizer> codecCustomizers;
|
|
|
|
|
|
|
|
|
|
|
|
private final ResourceHandlerRegistrationCustomizer resourceHandlerRegistrationCustomizer;
|
|
|
|
private final ResourceHandlerRegistrationCustomizer resourceHandlerRegistrationCustomizer;
|
|
|
|
|
|
|
|
|
|
|
|
private final List<ViewResolver> viewResolvers;
|
|
|
|
private final Stream<ViewResolver> viewResolvers;
|
|
|
|
|
|
|
|
|
|
|
|
public WebFluxConfig(ResourceProperties resourceProperties,
|
|
|
|
public WebFluxConfig(ResourceProperties resourceProperties,
|
|
|
|
WebFluxProperties webFluxProperties, ListableBeanFactory beanFactory,
|
|
|
|
WebFluxProperties webFluxProperties, ListableBeanFactory beanFactory,
|
|
|
|
ObjectProvider<List<HandlerMethodArgumentResolver>> resolvers,
|
|
|
|
ObjectProvider<HandlerMethodArgumentResolver> resolvers,
|
|
|
|
ObjectProvider<List<CodecCustomizer>> codecCustomizers,
|
|
|
|
ObjectProvider<CodecCustomizer> codecCustomizers,
|
|
|
|
ObjectProvider<ResourceHandlerRegistrationCustomizer> resourceHandlerRegistrationCustomizer,
|
|
|
|
ObjectProvider<ResourceHandlerRegistrationCustomizer> resourceHandlerRegistrationCustomizer,
|
|
|
|
ObjectProvider<List<ViewResolver>> viewResolvers) {
|
|
|
|
ObjectProvider<ViewResolver> viewResolvers) {
|
|
|
|
this.resourceProperties = resourceProperties;
|
|
|
|
this.resourceProperties = resourceProperties;
|
|
|
|
this.webFluxProperties = webFluxProperties;
|
|
|
|
this.webFluxProperties = webFluxProperties;
|
|
|
|
this.beanFactory = beanFactory;
|
|
|
|
this.beanFactory = beanFactory;
|
|
|
|
this.argumentResolvers = resolvers.getIfAvailable();
|
|
|
|
this.argumentResolvers = resolvers.orderedStream();
|
|
|
|
this.codecCustomizers = codecCustomizers.getIfAvailable();
|
|
|
|
this.codecCustomizers = codecCustomizers.orderedStream();
|
|
|
|
this.resourceHandlerRegistrationCustomizer = resourceHandlerRegistrationCustomizer
|
|
|
|
this.resourceHandlerRegistrationCustomizer = resourceHandlerRegistrationCustomizer
|
|
|
|
.getIfAvailable();
|
|
|
|
.getIfAvailable();
|
|
|
|
this.viewResolvers = viewResolvers.getIfAvailable();
|
|
|
|
this.viewResolvers = viewResolvers.orderedStream();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
|
|
|
|
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
|
|
|
|
if (this.argumentResolvers != null) {
|
|
|
|
this.argumentResolvers.forEach(configurer::addCustomResolver);
|
|
|
|
this.argumentResolvers.forEach(configurer::addCustomResolver);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void configureHttpMessageCodecs(ServerCodecConfigurer configurer) {
|
|
|
|
public void configureHttpMessageCodecs(ServerCodecConfigurer configurer) {
|
|
|
|
if (this.codecCustomizers != null) {
|
|
|
|
this.codecCustomizers
|
|
|
|
this.codecCustomizers
|
|
|
|
.forEach((customizer) -> customizer.customize(configurer));
|
|
|
|
.forEach((customizer) -> customizer.customize(configurer));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -186,10 +181,7 @@ public class WebFluxAutoConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void configureViewResolvers(ViewResolverRegistry registry) {
|
|
|
|
public void configureViewResolvers(ViewResolverRegistry registry) {
|
|
|
|
if (this.viewResolvers != null) {
|
|
|
|
this.viewResolvers.forEach(registry::viewResolver);
|
|
|
|
AnnotationAwareOrderComparator.sort(this.viewResolvers);
|
|
|
|
|
|
|
|
this.viewResolvers.forEach(registry::viewResolver);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|