Polish
This commit is contained in:
parent
698aa94cb4
commit
34de119eba
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import org.springframework.web.reactive.DispatcherHandler;
|
|||
import org.springframework.web.reactive.function.server.HandlerStrategies;
|
||||
import org.springframework.web.reactive.function.server.RouterFunction;
|
||||
import org.springframework.web.reactive.function.server.RouterFunctions;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import org.springframework.web.reactive.result.view.ViewResolver;
|
||||
import org.springframework.web.server.WebFilter;
|
||||
import org.springframework.web.server.WebHandler;
|
||||
|
|
@ -85,16 +86,16 @@ public class HttpHandlerAutoConfiguration {
|
|||
|
||||
private final WebSessionManager webSessionManager;
|
||||
|
||||
private final List<HttpMessageReader> messageReaders;
|
||||
private final List<HttpMessageReader<?>> messageReaders;
|
||||
|
||||
private final List<HttpMessageWriter> messageWriters;
|
||||
private final List<HttpMessageWriter<?>> messageWriters;
|
||||
|
||||
private final List<ViewResolver> viewResolvers;
|
||||
|
||||
public FunctionalConfig(ObjectProvider<List<WebFilter>> webFilters,
|
||||
ObjectProvider<WebSessionManager> webSessionManager,
|
||||
ObjectProvider<List<HttpMessageReader>> messageReaders,
|
||||
ObjectProvider<List<HttpMessageWriter>> messageWriters,
|
||||
ObjectProvider<List<HttpMessageReader<?>>> messageReaders,
|
||||
ObjectProvider<List<HttpMessageWriter<?>>> messageWriters,
|
||||
ObjectProvider<List<ViewResolver>> viewResolvers) {
|
||||
this.webFilters = webFilters.getIfAvailable();
|
||||
if (this.webFilters != null) {
|
||||
|
|
@ -107,9 +108,10 @@ public class HttpHandlerAutoConfiguration {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public HttpHandler httpHandler(List<RouterFunction> routerFunctions) {
|
||||
public <T extends ServerResponse> HttpHandler httpHandler(
|
||||
List<RouterFunction<T>> routerFunctions) {
|
||||
routerFunctions.sort(new AnnotationAwareOrderComparator());
|
||||
RouterFunction routerFunction = routerFunctions.stream()
|
||||
RouterFunction<T> routerFunction = routerFunctions.stream()
|
||||
.reduce(RouterFunction::and).get();
|
||||
HandlerStrategies.Builder strategiesBuilder = HandlerStrategies.builder();
|
||||
if (this.messageReaders != null) {
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ public class ResourceServerTokenServicesConfigurationTests {
|
|||
EnvironmentTestUtils.addEnvironment(this.environment,
|
||||
"security.oauth2.resource.jwt.key-uri=http://localhost:12345/banana");
|
||||
this.context = new SpringApplicationBuilder(ResourceConfiguration.class)
|
||||
.environment(this.environment).web(false).run();
|
||||
.environment(this.environment).web(WebApplicationType.NONE).run();
|
||||
assertThat(this.context.getBeansOfType(JwtAccessTokenConverter.class)).hasSize(1);
|
||||
}
|
||||
|
||||
|
|
@ -262,7 +262,7 @@ public class ResourceServerTokenServicesConfigurationTests {
|
|||
"security.oauth2.resource.jwt.key-uri=http://localhost:12345/banana");
|
||||
this.context = new SpringApplicationBuilder(ResourceConfiguration.class,
|
||||
JwtAccessTokenConverterRestTemplateCustomizerConfiguration.class)
|
||||
.environment(this.environment).web(false).run();
|
||||
.environment(this.environment).web(WebApplicationType.NONE).run();
|
||||
JwtAccessTokenConverterRestTemplateCustomizer customizer = this.context
|
||||
.getBean(JwtAccessTokenConverterRestTemplateCustomizer.class);
|
||||
verify(customizer).customize(any(RestTemplate.class));
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import org.springframework.http.server.reactive.HttpHandler;
|
|||
import org.springframework.web.reactive.function.server.RequestPredicates;
|
||||
import org.springframework.web.reactive.function.server.RouterFunction;
|
||||
import org.springframework.web.reactive.function.server.RouterFunctions;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import org.springframework.web.server.WebFilter;
|
||||
import org.springframework.web.server.WebHandler;
|
||||
import org.springframework.web.server.handler.FilteringWebHandler;
|
||||
|
|
@ -149,9 +150,9 @@ public class HttpHandlerAutoConfigurationTests {
|
|||
protected static class FunctionalConfig {
|
||||
|
||||
@Bean
|
||||
public RouterFunction routerFunction() {
|
||||
public RouterFunction<ServerResponse> routerFunction() {
|
||||
return RouterFunctions.route(RequestPredicates.GET("/test"),
|
||||
serverRequest -> null);
|
||||
(serverRequest) -> null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -160,9 +161,9 @@ public class HttpHandlerAutoConfigurationTests {
|
|||
protected static class FunctionalConfigWithWebFilters {
|
||||
|
||||
@Bean
|
||||
public RouterFunction routerFunction() {
|
||||
public RouterFunction<ServerResponse> routerFunction() {
|
||||
return RouterFunctions.route(RequestPredicates.GET("/test"),
|
||||
serverRequest -> null);
|
||||
(serverRequest) -> null);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
@ -181,9 +182,9 @@ public class HttpHandlerAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public RouterFunction routerFunction() {
|
||||
public RouterFunction<ServerResponse> routerFunction() {
|
||||
return RouterFunctions.route(RequestPredicates.GET("/test"),
|
||||
serverRequest -> null);
|
||||
(serverRequest) -> null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
Loading…
Reference in New Issue