diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/BindingContext.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/BindingContext.java similarity index 89% rename from spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/BindingContext.java rename to spring-web-reactive/src/main/java/org/springframework/web/reactive/BindingContext.java index 6d74469000f..ad75e8b55c9 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/BindingContext.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/BindingContext.java @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.web.reactive.result.method; + +package org.springframework.web.reactive; import org.springframework.ui.Model; import org.springframework.validation.support.BindingAwareConcurrentModel; @@ -22,7 +23,6 @@ import org.springframework.web.bind.WebExchangeDataBinder; import org.springframework.web.bind.support.WebBindingInitializer; import org.springframework.web.server.ServerWebExchange; - /** * A context for binding requests to method arguments that provides access to * the default model, data binding, validation, and type conversion. @@ -45,14 +45,6 @@ public class BindingContext { this.initializer = initializer; } - private static WebExchangeDataBinder initTypeConverter(WebBindingInitializer initializer) { - WebExchangeDataBinder binder = new WebExchangeDataBinder(null); - if (initializer != null) { - initializer.initBinder(binder); - } - return binder; - } - /** * Return the default model. @@ -65,7 +57,6 @@ public class BindingContext { /** * Create a {@link WebExchangeDataBinder} for applying data binding, type * conversion, and validation on the given "target" object. - * * @param exchange the current exchange * @param target the object to create a data binder for * @param name the name of the target object @@ -82,7 +73,6 @@ public class BindingContext { /** * Create a {@link WebExchangeDataBinder} without a "target" object, i.e. * for applying type conversion to simple types. - * * @param exchange the current exchange * @param name the name of the target object * @return a Mono for the created {@link WebDataBinder} instance @@ -101,9 +91,7 @@ public class BindingContext { /** * Initialize the data binder instance for the given exchange. */ - protected WebExchangeDataBinder initDataBinder(WebExchangeDataBinder binder, - ServerWebExchange exchange) { - + protected WebExchangeDataBinder initDataBinder(WebExchangeDataBinder binder, ServerWebExchange exchange) { return binder; } diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/HandlerResult.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/HandlerResult.java index b004a3faab5..2650b7f43ec 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/HandlerResult.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/HandlerResult.java @@ -25,7 +25,6 @@ import org.springframework.core.MethodParameter; import org.springframework.core.ResolvableType; import org.springframework.ui.Model; import org.springframework.util.Assert; -import org.springframework.web.reactive.result.method.BindingContext; /** * Represent the result of the invocation of a handler or a handler method. diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/HandlerMethodArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/HandlerMethodArgumentResolver.java index 5b53657979a..21215b0e262 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/HandlerMethodArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/HandlerMethodArgumentResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 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. @@ -19,9 +19,9 @@ package org.springframework.web.reactive.result.method; import reactor.core.publisher.Mono; import org.springframework.core.MethodParameter; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.server.ServerWebExchange; - /** * Strategy interface for resolving method parameters into argument values in * the context of a given request. @@ -31,7 +31,6 @@ import org.springframework.web.server.ServerWebExchange; */ public interface HandlerMethodArgumentResolver { - boolean supportsParameter(MethodParameter parameter); /** diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java index d82f9faef8e..03879044dac 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java @@ -36,11 +36,12 @@ import org.springframework.util.ClassUtils; import org.springframework.util.ObjectUtils; import org.springframework.util.ReflectionUtils; import org.springframework.web.method.HandlerMethod; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.HandlerResult; import org.springframework.web.server.ServerWebExchange; /** - * A sub-class of {@link HandlerMethod} that can resolve method arguments from + * A subclass of {@link HandlerMethod} that can resolve method arguments from * a {@link ServerWebExchange} and use that to invoke the underlying method. * * @author Rossen Stoyanchev diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncHandlerMethodArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncHandlerMethodArgumentResolver.java index 2a2df9c7373..b9601a68463 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncHandlerMethodArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncHandlerMethodArgumentResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 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. @@ -21,9 +21,9 @@ import java.util.Optional; import reactor.core.publisher.Mono; import org.springframework.core.MethodParameter; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.server.ServerWebExchange; - /** * An extension of {@link HandlerMethodArgumentResolver} for implementations * that are synchronous in nature and do not block to resolve values. diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncInvocableHandlerMethod.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncInvocableHandlerMethod.java index ef7a17d341d..ddecf58e125 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncInvocableHandlerMethod.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncInvocableHandlerMethod.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method; import java.lang.reflect.Method; @@ -21,6 +22,7 @@ import java.util.List; import org.springframework.util.Assert; import org.springframework.web.method.HandlerMethod; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.HandlerResult; import org.springframework.web.server.ServerWebExchange; @@ -35,7 +37,6 @@ import org.springframework.web.server.ServerWebExchange; */ public class SyncInvocableHandlerMethod extends InvocableHandlerMethod { - public SyncInvocableHandlerMethod(HandlerMethod handlerMethod) { super(handlerMethod); } diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java index 58414125575..33d7ba54960 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import java.lang.annotation.Annotation; @@ -38,12 +39,12 @@ import org.springframework.http.server.reactive.ServerHttpResponse; import org.springframework.util.Assert; import org.springframework.validation.Validator; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.WebExchangeBindException; import org.springframework.web.bind.WebExchangeDataBinder; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebInputException; import org.springframework.web.server.UnsupportedMediaTypeStatusException; -import org.springframework.web.bind.WebExchangeBindException; /** * Abstract base class for argument resolvers that resolve method arguments diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueArgumentResolver.java index 3a38916ab25..d10b5102767 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueArgumentResolver.java @@ -30,7 +30,7 @@ import org.springframework.core.MethodParameter; import org.springframework.ui.Model; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.ValueConstants; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; import org.springframework.web.server.ServerErrorException; import org.springframework.web.server.ServerWebExchange; @@ -40,6 +40,7 @@ import org.springframework.web.server.ServerWebInputException; * Abstract base class for resolving method arguments from a named value. * Request parameters, request headers, and path variables are examples of named * values. Each may have a name, a required flag, and a default value. + * *

Subclasses define how to do the following: *

+ * *

A default value string can contain ${...} placeholders and Spring Expression * Language #{...} expressions. For this to work a * {@link ConfigurableBeanFactory} must be supplied to the class constructor. diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueSyncArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueSyncArgumentResolver.java index 4933fd3fcbf..9b31533290d 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueSyncArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueSyncArgumentResolver.java @@ -22,7 +22,7 @@ import reactor.core.publisher.Mono; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.core.MethodParameter; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver; import org.springframework.web.server.ServerWebExchange; @@ -38,7 +38,6 @@ import org.springframework.web.server.ServerWebExchange; public abstract class AbstractNamedValueSyncArgumentResolver extends AbstractNamedValueArgumentResolver implements SyncHandlerMethodArgumentResolver { - public AbstractNamedValueSyncArgumentResolver(ConfigurableBeanFactory beanFactory) { super(beanFactory); } diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactory.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactory.java index 4d77aa9e1e9..2ecbed21bc9 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactory.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactory.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import java.lang.reflect.Method; @@ -33,8 +34,8 @@ import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.support.WebBindingInitializer; import org.springframework.web.method.HandlerMethod; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.HandlerResult; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; import org.springframework.web.reactive.result.method.InvocableHandlerMethod; import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver; diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolver.java index 8bba67f9181..06bd277e35f 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolver.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import reactor.core.publisher.Mono; @@ -27,7 +28,7 @@ import org.springframework.util.StringUtils; import org.springframework.validation.BindingResult; import org.springframework.validation.Errors; import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; import org.springframework.web.server.ServerWebExchange; diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolver.java index 98c6e90f9a2..1150d938109 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolver.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import java.util.List; @@ -28,7 +29,7 @@ import org.springframework.http.RequestEntity; import org.springframework.http.codec.HttpMessageReader; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.validation.Validator; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; import org.springframework.web.server.ServerWebExchange; @@ -43,7 +44,6 @@ import org.springframework.web.server.ServerWebExchange; public class HttpEntityArgumentResolver extends AbstractMessageReaderArgumentResolver implements HandlerMethodArgumentResolver { - /** * Constructor with {@link HttpMessageReader}'s and a {@link Validator}. * @param readers readers for de-serializing the request body with diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContext.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContext.java index d51f3ca6cfa..8514e68eb49 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContext.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContext.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import java.util.Arrays; @@ -24,8 +25,8 @@ import org.springframework.web.bind.WebExchangeDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.support.WebBindingInitializer; import org.springframework.web.method.HandlerMethod; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.HandlerResult; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.reactive.result.method.SyncInvocableHandlerMethod; import org.springframework.web.server.ServerWebExchange; diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelArgumentResolver.java index c964f8bb47c..fcf97df3609 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelArgumentResolver.java @@ -13,13 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import java.util.Optional; import org.springframework.core.MethodParameter; import org.springframework.ui.Model; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver; import org.springframework.web.server.ServerWebExchange; @@ -31,7 +32,6 @@ import org.springframework.web.server.ServerWebExchange; */ public class ModelArgumentResolver implements SyncHandlerMethodArgumentResolver { - @Override public boolean supportsParameter(MethodParameter parameter) { return Model.class.isAssignableFrom(parameter.getParameterType()); diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolver.java index 9183c69e96e..9756b9a7334 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolver.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import java.lang.annotation.Annotation; @@ -37,7 +38,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.WebExchangeBindException; import org.springframework.web.bind.WebExchangeDataBinder; import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; import org.springframework.web.server.ServerWebExchange; diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolver.java index 19537875231..0541b0ef786 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolver.java @@ -23,8 +23,8 @@ import java.util.Optional; import org.springframework.core.MethodParameter; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.HandlerMapping; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver; import org.springframework.web.server.ServerWebExchange; @@ -40,7 +40,6 @@ import org.springframework.web.server.ServerWebExchange; */ public class PathVariableMapMethodArgumentResolver implements SyncHandlerMethodArgumentResolver { - @Override public boolean supportsParameter(MethodParameter parameter) { PathVariable ann = parameter.getParameterAnnotation(PathVariable.class); diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PrincipalArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PrincipalArgumentResolver.java index 708020c57c9..9de42f8aa23 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PrincipalArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PrincipalArgumentResolver.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import java.security.Principal; @@ -20,7 +21,7 @@ import java.security.Principal; import reactor.core.publisher.Mono; import org.springframework.core.MethodParameter; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; import org.springframework.web.server.ServerWebExchange; diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolver.java index 74144e76ef9..8f518fc5e74 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolver.java @@ -25,7 +25,7 @@ import org.springframework.core.ReactiveAdapterRegistry; import org.springframework.http.codec.HttpMessageReader; import org.springframework.validation.Validator; import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebInputException; @@ -47,7 +47,6 @@ import org.springframework.web.server.ServerWebInputException; public class RequestBodyArgumentResolver extends AbstractMessageReaderArgumentResolver implements HandlerMethodArgumentResolver { - /** * Constructor with {@link HttpMessageReader}'s and a {@link Validator}. * @param readers readers for de-serializing the request body with diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMapMethodArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMapMethodArgumentResolver.java index 40ea3d7ecd8..5e9a5559179 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMapMethodArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMapMethodArgumentResolver.java @@ -23,7 +23,7 @@ import org.springframework.core.MethodParameter; import org.springframework.http.HttpHeaders; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver; import org.springframework.web.server.ServerWebExchange; diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java index c5508ee916d..3896741ce46 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java @@ -47,9 +47,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.support.WebBindingInitializer; import org.springframework.web.method.HandlerMethod; import org.springframework.web.method.annotation.ExceptionHandlerMethodResolver; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.HandlerAdapter; import org.springframework.web.reactive.HandlerResult; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; import org.springframework.web.reactive.result.method.InvocableHandlerMethod; import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver; diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java index d92602ac543..979ca7b8f2a 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java @@ -23,7 +23,7 @@ import org.springframework.core.MethodParameter; import org.springframework.util.MultiValueMap; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver; import org.springframework.web.server.ServerWebExchange; diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolver.java index 5634a2d8be1..07b77c5f11d 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolver.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import java.util.Optional; @@ -21,7 +22,7 @@ import org.springframework.core.MethodParameter; import org.springframework.http.HttpMethod; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.http.server.reactive.ServerHttpResponse; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver; import org.springframework.web.server.ServerWebExchange; diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/WebSessionArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/WebSessionArgumentResolver.java index 22e38a5281c..bcac9a23dc7 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/WebSessionArgumentResolver.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/WebSessionArgumentResolver.java @@ -13,19 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.web.reactive.result.method.annotation; -import java.util.Optional; +package org.springframework.web.reactive.result.method.annotation; import reactor.core.publisher.Mono; import org.springframework.core.MethodParameter; -import org.springframework.http.HttpMethod; -import org.springframework.http.server.reactive.ServerHttpRequest; -import org.springframework.http.server.reactive.ServerHttpResponse; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; -import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.WebSession; diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java index 64c53f9acae..674d3cb79aa 100644 --- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java +++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java @@ -42,11 +42,11 @@ import org.springframework.util.StringUtils; import org.springframework.validation.BindingResult; import org.springframework.web.bind.WebExchangeDataBinder; import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.HandlerResult; import org.springframework.web.reactive.HandlerResultHandler; import org.springframework.web.reactive.accept.RequestedContentTypeResolver; import org.springframework.web.reactive.result.AbstractHandlerResultHandler; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.server.NotAcceptableStatusException; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.util.HttpRequestPathHelper; diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java index 0ee5998e9aa..da13ddb5039 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java @@ -27,6 +27,7 @@ import reactor.test.StepVerifier; import org.springframework.http.HttpMethod; import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.HandlerResult; import org.springframework.web.reactive.result.ResolvableMethod; import org.springframework.web.server.ServerWebExchange; @@ -36,6 +37,7 @@ import org.springframework.web.server.session.MockWebSessionManager; import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; +import static org.mockito.Mockito.any; import static org.mockito.Mockito.*; /** diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java index 047eb101921..f13aa777c8b 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java @@ -47,10 +47,11 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.method.HandlerMethod; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.HandlerMapping; import org.springframework.web.reactive.HandlerResult; import org.springframework.web.reactive.result.ResolvableMethod; -import org.springframework.web.reactive.result.method.RequestMappingInfo.BuilderConfiguration; +import org.springframework.web.reactive.result.method.RequestMappingInfo.*; import org.springframework.web.server.MethodNotAllowedException; import org.springframework.web.server.NotAcceptableStatusException; import org.springframework.web.server.ServerWebExchange; @@ -61,16 +62,10 @@ import org.springframework.web.server.session.MockWebSessionManager; import org.springframework.web.server.session.WebSessionManager; import org.springframework.web.util.HttpRequestPathHelper; -import static org.hamcrest.CoreMatchers.containsString; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.springframework.web.bind.annotation.RequestMethod.GET; -import static org.springframework.web.bind.annotation.RequestMethod.HEAD; -import static org.springframework.web.bind.annotation.RequestMethod.OPTIONS; -import static org.springframework.web.reactive.result.method.RequestMappingInfo.paths; +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.*; +import static org.springframework.web.bind.annotation.RequestMethod.*; +import static org.springframework.web.reactive.result.method.RequestMappingInfo.*; /** * Unit tests for {@link RequestMappingInfoHandlerMapping}. diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactoryTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactoryTests.java index 68014671dcc..4b71e4cfeaf 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactoryTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactoryTests.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import java.util.Collections; @@ -36,17 +37,16 @@ import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.method.HandlerMethod; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.config.WebReactiveConfigurationSupport; import org.springframework.web.reactive.result.ResolvableMethod; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.DefaultWebSessionManager; import org.springframework.web.server.session.WebSessionManager; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; /** * Unit tests for {@link BindingContextFactory}. @@ -77,7 +77,6 @@ public class BindingContextFactoryTests { @SuppressWarnings("unchecked") @Test public void basic() throws Exception { - Validator validator = mock(Validator.class); TestController controller = new TestController(validator); @@ -117,12 +116,10 @@ public class BindingContextFactoryTests { private Validator[] validators; - public TestController(Validator... validators) { this.validators = validators; } - @InitBinder public void initDataBinder(WebDataBinder dataBinder) { if (!ObjectUtils.isEmpty(this.validators)) { @@ -161,6 +158,7 @@ public class BindingContextFactoryTests { public void handle() {} } + private static class TestBean { private final String name; diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java index 5de9d678ba1..b3d38d63a40 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java @@ -32,16 +32,14 @@ import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebInputException; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.MockWebSessionManager; import org.springframework.web.server.session.WebSessionManager; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; /** * Test fixture with {@link CookieValueMethodArgumentResolver}. diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsArgumentResolverTests.java index b4b414ec3cc..da647ee36d0 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsArgumentResolverTests.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import org.junit.Before; @@ -30,8 +31,8 @@ import org.springframework.validation.BindingResult; import org.springframework.validation.Errors; import org.springframework.web.bind.WebExchangeDataBinder; import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.ResolvableMethod; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.MockWebSessionManager; @@ -40,11 +41,11 @@ import org.springframework.web.server.session.WebSessionManager; import static junit.framework.TestCase.assertFalse; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import static org.springframework.core.ResolvableType.forClass; -import static org.springframework.core.ResolvableType.forClassWithGenerics; +import static org.springframework.core.ResolvableType.*; /** * Unit tests for {@link ErrorsMethodArgumentResolver}. + * * @author Rossen Stoyanchev */ public class ErrorsArgumentResolverTests { diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ExpressionValueMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ExpressionValueMethodArgumentResolverTests.java index 9d125e03597..8823ea7770f 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ExpressionValueMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ExpressionValueMethodArgumentResolverTests.java @@ -29,15 +29,13 @@ import org.springframework.http.HttpMethod; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.MockWebSessionManager; import org.springframework.web.server.session.WebSessionManager; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; /** * Unit tests for {@link ExpressionValueMethodArgumentResolver}. @@ -96,8 +94,7 @@ public class ExpressionValueMethodArgumentResolverTests { @SuppressWarnings("unused") - public void params(@Value("#{systemProperties.systemProperty}") int param1, - String notSupported) { + public void params(@Value("#{systemProperties.systemProperty}") int param1, String notSupported) { } -} \ No newline at end of file +} diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolverTests.java index fa64b85cfe4..630d6908d4e 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolverTests.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import java.nio.ByteBuffer; @@ -46,19 +47,15 @@ import org.springframework.http.codec.DecoderHttpMessageReader; import org.springframework.http.codec.HttpMessageReader; import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.ResolvableMethod; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebInputException; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.MockWebSessionManager; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.springframework.core.ResolvableType.forClassWithGenerics; +import static org.junit.Assert.*; +import static org.springframework.core.ResolvableType.*; /** * Unit tests for {@link HttpEntityArgumentResolver}.When adding a test also diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContextTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContextTests.java index d66b1fdfd32..5e8540a3636 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContextTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContextTests.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import java.lang.reflect.Method; @@ -31,18 +32,14 @@ import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver; import org.springframework.web.reactive.result.method.SyncInvocableHandlerMethod; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.DefaultWebSessionManager; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; - +import static org.junit.Assert.*; /** * Unit tests for {@link InitBinderBindingContext}. diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageReaderArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageReaderArgumentResolverTests.java index 9c6ae04f313..273f6daf99f 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageReaderArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageReaderArgumentResolverTests.java @@ -52,23 +52,20 @@ import org.springframework.validation.Validator; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; import org.springframework.web.method.HandlerMethod; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.ResolvableMethod; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebInputException; import org.springframework.web.server.UnsupportedMediaTypeStatusException; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.MockWebSessionManager; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.springframework.core.ResolvableType.forClass; -import static org.springframework.core.ResolvableType.forClassWithGenerics; +import static org.junit.Assert.*; +import static org.springframework.core.ResolvableType.*; /** * Unit tests for {@link AbstractMessageReaderArgumentResolver}. + * * @author Rossen Stoyanchev */ public class MessageReaderArgumentResolverTests { @@ -266,7 +263,8 @@ public class MessageReaderArgumentResolverTests { assertArrayEquals(new TestBean[] {new TestBean("f1", "b1"), new TestBean("f2", "b2")}, value); } - @Test @SuppressWarnings("unchecked") + @Test + @SuppressWarnings("unchecked") public void validateMonoTestBean() throws Exception { String body = "{\"bar\":\"b1\"}"; ResolvableType type = forClassWithGenerics(Mono.class, TestBean.class); @@ -276,7 +274,8 @@ public class MessageReaderArgumentResolverTests { StepVerifier.create(mono).expectNextCount(0).expectError(ServerWebInputException.class).verify(); } - @Test @SuppressWarnings("unchecked") + @Test + @SuppressWarnings("unchecked") public void validateFluxTestBean() throws Exception { String body = "[{\"bar\":\"b1\",\"foo\":\"f1\"},{\"bar\":\"b2\"}]"; ResolvableType type = forClassWithGenerics(Flux.class, TestBean.class); @@ -289,7 +288,7 @@ public class MessageReaderArgumentResolverTests { .verify(); } - @Test // SPR-9964 + @Test // SPR-9964 public void parameterizedMethodArgument() throws Exception { Method method = AbstractParameterizedController.class.getMethod("handleDto", Identifiable.class); HandlerMethod handlerMethod = new HandlerMethod(new ConcreteParameterizedController(), method); @@ -337,7 +336,8 @@ public class MessageReaderArgumentResolverTests { List list, Mono> monoList, Set set, - TestBean[] array) {} + TestBean[] array) { + } @XmlRootElement @@ -395,6 +395,7 @@ public class MessageReaderArgumentResolverTests { } } + private static class TestBeanValidator implements Validator { @Override @@ -411,15 +412,18 @@ public class MessageReaderArgumentResolverTests { } } + private static abstract class AbstractParameterizedController { @SuppressWarnings("unused") public void handleDto(DTO dto) {} } + private static class ConcreteParameterizedController extends AbstractParameterizedController { } + private interface Identifiable extends Serializable { Long getId(); @@ -427,6 +431,7 @@ public class MessageReaderArgumentResolverTests { void setId(Long id); } + @SuppressWarnings({"serial"}) private static class SimpleBean implements Identifiable { diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolverTests.java index 19061df2879..028ec80f2b3 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolverTests.java @@ -39,8 +39,8 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import org.springframework.web.bind.WebExchangeBindException; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.ResolvableMethod; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.adapter.DefaultServerWebExchange; @@ -51,9 +51,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import static org.springframework.core.ResolvableType.forClass; -import static org.springframework.core.ResolvableType.forClassWithGenerics; -import static org.springframework.util.Assert.isTrue; +import static org.springframework.core.ResolvableType.*; +import static org.springframework.util.Assert.*; /** @@ -296,6 +295,18 @@ public class ModelAttributeMethodArgumentResolverTests { } + @SuppressWarnings("unused") + void handle( + @ModelAttribute @Validated Foo foo, + @ModelAttribute @Validated Mono mono, + @ModelAttribute @Validated Single single, + Foo fooNotAnnotated, + String stringNotAnnotated, + Mono monoNotAnnotated, + Mono monoStringNotAnnotated) { + } + + private static class Foo { private String name; @@ -326,14 +337,4 @@ public class ModelAttributeMethodArgumentResolverTests { } } - @SuppressWarnings("unused") - void handle( - @ModelAttribute @Validated Foo foo, - @ModelAttribute @Validated Mono mono, - @ModelAttribute @Validated Single single, - Foo fooNotAnnotated, - String stringNotAnnotated, - Mono monoNotAnnotated, - Mono monoStringNotAnnotated) {} - } diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolverTests.java index 736a70d89a5..b2abd1d6e15 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolverTests.java @@ -31,16 +31,14 @@ import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.HandlerMapping; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.MockWebSessionManager; import org.springframework.web.server.session.WebSessionManager; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; /** * Unit tests for {@link PathVariableMapMethodArgumentResolver}. @@ -72,6 +70,7 @@ public class PathVariableMapMethodArgumentResolverTests { this.paramMapNoAnnot = new MethodParameter(method, 2); } + @Test public void supportsParameter() { assertTrue(resolver.supportsParameter(paramMap)); @@ -108,4 +107,4 @@ public class PathVariableMapMethodArgumentResolverTests { Map mapWithoutAnnotat) { } -} \ No newline at end of file +} diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java index 2ab940ea9d1..20c90560da2 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java @@ -36,17 +36,15 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse import org.springframework.util.ReflectionUtils; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.HandlerMapping; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.server.ServerErrorException; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.MockWebSessionManager; import org.springframework.web.server.session.WebSessionManager; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; /** * Unit tests for {@link PathVariableMethodArgumentResolver}. diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java index e8956919474..0d674d7d415 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.reactive.result.method.annotation; import java.lang.reflect.Method; @@ -36,23 +37,18 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse import org.springframework.util.ReflectionUtils; import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebInputException; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.MockWebSessionManager; import org.springframework.web.server.session.WebSessionManager; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - +import static org.junit.Assert.*; /** * Unit tests for {@link RequestAttributeMethodArgumentResolver}. + * * @author Rossen Stoyanchev */ public class RequestAttributeMethodArgumentResolverTests { @@ -163,6 +159,7 @@ public class RequestAttributeMethodArgumentResolverTests { String notSupported) { } + private static class Foo { } diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolverTests.java index dd3b2d69072..277a4cd0888 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolverTests.java @@ -41,20 +41,15 @@ import org.springframework.http.codec.HttpMessageReader; import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.ResolvableMethod; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebInputException; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.MockWebSessionManager; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.springframework.core.ResolvableType.forClass; -import static org.springframework.core.ResolvableType.forClassWithGenerics; +import static org.junit.Assert.*; +import static org.springframework.core.ResolvableType.*; /** * Unit tests for {@link RequestBodyArgumentResolver}. When adding a test also diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java index 739f4c4effd..20f2f8255f0 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java @@ -39,17 +39,14 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse import org.springframework.util.ReflectionUtils; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebInputException; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.MockWebSessionManager; import org.springframework.web.server.session.WebSessionManager; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; /** * Unit tests for {@link RequestHeaderMethodArgumentResolver}. diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java index e013a68b64e..bc7e1cc9a67 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java @@ -38,18 +38,14 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse import org.springframework.util.ReflectionUtils; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebInputException; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.MockWebSessionManager; import org.springframework.web.server.session.WebSessionManager; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; /** * Unit tests for {@link RequestParamMethodArgumentResolver}. diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolverTests.java index b70f5d84db2..7fc4a81d088 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolverTests.java @@ -26,8 +26,8 @@ import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.http.server.reactive.ServerHttpResponse; import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.result.ResolvableMethod; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.WebSession; import org.springframework.web.server.adapter.DefaultServerWebExchange; diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java index 3da71b8a31d..ae9914dabe2 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java @@ -37,7 +37,7 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse import org.springframework.util.ReflectionUtils; import org.springframework.web.bind.annotation.SessionAttribute; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; -import org.springframework.web.reactive.result.method.BindingContext; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebInputException; import org.springframework.web.server.WebSession; diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java index 57f2b4206f9..7c8e16194ad 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java @@ -50,24 +50,23 @@ import org.springframework.ui.ConcurrentModel; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.HandlerResult; import org.springframework.web.reactive.accept.HeaderContentTypeResolver; import org.springframework.web.reactive.accept.RequestedContentTypeResolver; import org.springframework.web.reactive.result.ResolvableMethod; -import org.springframework.web.reactive.result.method.BindingContext; import org.springframework.web.server.NotAcceptableStatusException; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.DefaultWebSessionManager; import org.springframework.web.server.session.WebSessionManager; -import static java.nio.charset.StandardCharsets.UTF_8; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.springframework.core.ResolvableType.forClass; -import static org.springframework.core.ResolvableType.forClassWithGenerics; -import static org.springframework.core.io.buffer.support.DataBufferTestUtils.dumpString; -import static org.springframework.http.MediaType.APPLICATION_JSON; +import static java.nio.charset.StandardCharsets.*; +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; +import static org.springframework.core.ResolvableType.*; +import static org.springframework.core.io.buffer.support.DataBufferTestUtils.*; +import static org.springframework.http.MediaType.*; /** * Unit tests for {@link ViewResolutionResultHandler}.