Polishing

This commit is contained in:
Juergen Hoeller 2019-09-27 10:17:56 +02:00
parent 6a207d0012
commit 2861fc65bd
35 changed files with 108 additions and 121 deletions

View File

@ -52,9 +52,8 @@ abstract class ParserStrategyUtils {
* @since 5.2
*/
@SuppressWarnings("unchecked")
static <T> T instantiateClass(Class<?> clazz, Class<T> assignableTo,
Environment environment, ResourceLoader resourceLoader,
BeanDefinitionRegistry registry) {
static <T> T instantiateClass(Class<?> clazz, Class<T> assignableTo, Environment environment,
ResourceLoader resourceLoader, BeanDefinitionRegistry registry) {
Assert.notNull(clazz, "Class must not be null");
Assert.isAssignable(assignableTo, clazz);

View File

@ -358,7 +358,6 @@ public interface DataBuffer {
/**
* Return this buffer's data a String using the specified charset. Default implementation
* delegates to {@code toString(readPosition(), readableByteCount(), charset)}.
*
* @param charset the character set to use
* @return a string representation of all this buffers data
* @since 5.2
@ -370,7 +369,6 @@ public interface DataBuffer {
/**
* Return a part of this buffer's data as a String using the specified charset.
*
* @param index the index at which to start the string
* @param length the number of bytes to use for the string
* @param charset the charset to use

View File

@ -164,8 +164,9 @@ public abstract class DataBufferUtils {
* @return a Flux of data buffers read from the given channel
* @since 5.2
*/
public static Flux<DataBuffer> read(Path path, DataBufferFactory bufferFactory, int bufferSize,
OpenOption... options) {
public static Flux<DataBuffer> read(
Path path, DataBufferFactory bufferFactory, int bufferSize, OpenOption... options) {
Assert.notNull(path, "Path must not be null");
Assert.notNull(bufferFactory, "BufferFactory must not be null");
Assert.isTrue(bufferSize > 0, "'bufferSize' must be > 0");
@ -538,8 +539,8 @@ public abstract class DataBufferUtils {
}
/**
* Return a {@link Matcher} for the given delimiter. The matcher can be used to find the
* delimiters in data buffers.
* Return a {@link Matcher} for the given delimiter.
* The matcher can be used to find the delimiters in data buffers.
* @param delimiter the delimiter bytes to find
* @return the matcher
* @since 5.2
@ -549,8 +550,8 @@ public abstract class DataBufferUtils {
return new KnuthMorrisPrattMatcher(delimiter);
}
/** Return a {@link Matcher} for the given delimiters. The matcher can be used to find the
* delimiters in data buffers.
/** Return a {@link Matcher} for the given delimiters.
* The matcher can be used to find the delimiters in data buffers.
* @param delimiters the delimiters bytes to find
* @return the matcher
* @since 5.2
@ -595,7 +596,6 @@ public abstract class DataBufferUtils {
* Resets the state of this matcher.
*/
void reset();
}
@ -730,7 +730,6 @@ public abstract class DataBufferUtils {
private boolean isNotDisposed() {
return !this.disposed.get();
}
}
@ -866,12 +865,11 @@ public abstract class DataBufferUtils {
this.sink.next(dataBuffer);
this.dataBuffer.set(null);
}
}
/**
* Implementation of {@link Matcher} that uses the Knuth-Morris-Pratt algorithm.
*
* @see <a href="https://www.nayuki.io/page/knuth-morris-pratt-string-matching">Knuth-Morris-Pratt string matching</a>
*/
private static class KnuthMorrisPrattMatcher implements Matcher {
@ -882,7 +880,6 @@ public abstract class DataBufferUtils {
private int matches = 0;
public KnuthMorrisPrattMatcher(byte[] delimiter) {
this.delimiter = Arrays.copyOf(delimiter, delimiter.length);
this.table = longestSuffixPrefixTable(delimiter);
@ -935,6 +932,7 @@ public abstract class DataBufferUtils {
}
}
/**
* Implementation of {@link Matcher} that wraps several other matchers.
*/
@ -946,7 +944,6 @@ public abstract class DataBufferUtils {
byte[] longestDelimiter = NO_DELIMITER;
public CompositeMatcher(Matcher[] matchers) {
this.matchers = matchers;
}

View File

@ -42,7 +42,6 @@ public interface RouteMatcher {
*/
Route parseRoute(String routeValue);
/**
* Whether the given {@code route} contains pattern syntax which requires
* the {@link #match(String, Route)} method, or if it is a regular String

View File

@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.util;
import java.util.Comparator;
@ -36,12 +37,18 @@ public class SimpleRouteMatcher implements RouteMatcher {
private final PathMatcher pathMatcher;
/**
* Create a new {@code SimpleRouteMatcher} for the given
* {@link PathMatcher} delegate.
*/
public SimpleRouteMatcher(PathMatcher pathMatcher) {
Assert.notNull(pathMatcher, "PathMatcher is required");
this.pathMatcher = pathMatcher;
}
/**
* Return the underlying {@link PathMatcher} delegate.
*/
public PathMatcher getPathMatcher() {
return this.pathMatcher;
}
@ -86,12 +93,10 @@ public class SimpleRouteMatcher implements RouteMatcher {
private final String path;
DefaultRoute(String path) {
this.path = path;
}
@Override
public String value() {
return this.path;

View File

@ -85,7 +85,7 @@ public abstract class ScriptUtils {
* Default prefixes for single-line comments within SQL scripts: {@code ["--"]}.
* @since 5.2
*/
public static final String[] DEFAULT_COMMENT_PREFIXES = { DEFAULT_COMMENT_PREFIX };
public static final String[] DEFAULT_COMMENT_PREFIXES = {DEFAULT_COMMENT_PREFIX};
/**
* Default start delimiter for block comments within SQL scripts: {@code "/*"}.
@ -214,8 +214,8 @@ public abstract class ScriptUtils {
Assert.hasText(script, "'script' must not be null or empty");
Assert.notNull(separator, "'separator' must not be null");
Assert.notEmpty(commentPrefixes, "'commentPrefixes' must not be null or empty");
for (int i = 0; i < commentPrefixes.length; i++) {
Assert.hasText(commentPrefixes[i], "'commentPrefixes' must not contain null or empty elements");
for (String commentPrefix : commentPrefixes) {
Assert.hasText(commentPrefix, "'commentPrefixes' must not contain null or empty elements");
}
Assert.hasText(blockCommentStartDelimiter, "'blockCommentStartDelimiter' must not be null or empty");
Assert.hasText(blockCommentEndDelimiter, "'blockCommentEndDelimiter' must not be null or empty");

View File

@ -31,7 +31,7 @@ public interface ReactiveMessageHandler {
/**
* Handle the given message.
* @param message the message to be handled
* @return a completion {@link Mono} for the result of the message handling.
* @return a completion {@link Mono} for the result of the message handling
*/
Mono<Void> handleMessage(Message<?> message);

View File

@ -55,12 +55,10 @@ public @interface ConnectMapping {
* Mappings expressed by this annotation to match to the route from the
* metadata of the initial {@link ConnectionSetupPayload} or in
* subsequent metadata pushes.
*
* <p>Depending on the configured
* {@link org.springframework.util.RouteMatcher RouteMatcher}, the pattern may be
* {@link org.springframework.util.AntPathMatcher AntPathMatcher} or
* {@link org.springframework.web.util.pattern.PathPattern PathPattern} based.
*
* <p>By default this is an empty array in which case it matches all
* {@link ConnectionSetupPayload} and metadata pushes.
*/

View File

@ -1053,7 +1053,6 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
private final AtomicInteger disconnect = new AtomicInteger();
public void incrementConnectCount() {
this.connect.incrementAndGet();
}

View File

@ -125,9 +125,7 @@ public class TransactionSynchronizationManager {
*/
@Nullable
private Object doGetResource(Object actualKey) {
Map<Object, Object> map = this.transactionContext.getResources();
Object value = map.get(actualKey);
return value;
return this.transactionContext.getResources().get(actualKey);
}
/**

View File

@ -171,7 +171,6 @@ public final class MultipartBodyBuilder {
* @param elementClass the type of elements contained in the publisher
* @return builder that allows for further customization of part headers
*/
@SuppressWarnings("unchecked")
public <T, P extends Publisher<T>> PartBuilder asyncPart(String name, P publisher, Class<T> elementClass) {
Assert.hasLength(name, "'name' must not be empty");
Assert.notNull(publisher, "'publisher' must not be null");

View File

@ -53,21 +53,6 @@ public class JettyClientHttpConnector implements ClientHttpConnector {
this(new HttpClient());
}
/**
* Constructor with an {@link JettyResourceFactory} that will manage shared resources.
* @param resourceFactory the {@link JettyResourceFactory} to use
* @param customizer the lambda used to customize the {@link HttpClient}
* @deprecated as of 5.2, in favor of {@link JettyClientHttpConnector#JettyClientHttpConnector(HttpClient, JettyResourceFactory)}
*/
@Deprecated
public JettyClientHttpConnector(
JettyResourceFactory resourceFactory, @Nullable Consumer<HttpClient> customizer) {
this(new HttpClient(), resourceFactory);
if (customizer != null) {
customizer.accept(this.httpClient);
}
}
/**
* Constructor with an initialized {@link HttpClient}.
*/
@ -82,8 +67,7 @@ public class JettyClientHttpConnector implements ClientHttpConnector {
* @param resourceFactory the {@link JettyResourceFactory} to use
* @since 5.2
*/
public JettyClientHttpConnector(HttpClient httpClient,
@Nullable JettyResourceFactory resourceFactory) {
public JettyClientHttpConnector(HttpClient httpClient, @Nullable JettyResourceFactory resourceFactory) {
Assert.notNull(httpClient, "HttpClient is required");
if (resourceFactory != null) {
httpClient.setExecutor(resourceFactory.getExecutor());
@ -93,6 +77,20 @@ public class JettyClientHttpConnector implements ClientHttpConnector {
this.httpClient = httpClient;
}
/**
* Constructor with an {@link JettyResourceFactory} that will manage shared resources.
* @param resourceFactory the {@link JettyResourceFactory} to use
* @param customizer the lambda used to customize the {@link HttpClient}
* @deprecated as of 5.2, in favor of {@link JettyClientHttpConnector#JettyClientHttpConnector(HttpClient, JettyResourceFactory)}
*/
@Deprecated
public JettyClientHttpConnector(JettyResourceFactory resourceFactory, @Nullable Consumer<HttpClient> customizer) {
this(new HttpClient(), resourceFactory);
if (customizer != null) {
customizer.accept(this.httpClient);
}
}
public void setBufferFactory(DataBufferFactory bufferFactory) {
this.bufferFactory = bufferFactory;

View File

@ -130,8 +130,7 @@ public abstract class HttpAccessor {
}
private void initialize(ClientHttpRequest request) {
this.clientHttpRequestInitializers.forEach(
initializer -> initializer.initialize(request));
this.clientHttpRequestInitializers.forEach(initializer -> initializer.initialize(request));
}
}

View File

@ -51,8 +51,10 @@ public class Jackson2CborDecoder extends AbstractJackson2Decoder {
Assert.isAssignable(CBORFactory.class, mapper.getFactory().getClass());
}
@Override
public Flux<Object> decode(Publisher<DataBuffer> input, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) {
throw new UnsupportedOperationException("Does not support stream decoding yet");
}
}

View File

@ -52,8 +52,10 @@ public class Jackson2CborEncoder extends AbstractJackson2Encoder {
Assert.isAssignable(CBORFactory.class, mapper.getFactory().getClass());
}
@Override
public Flux<DataBuffer> encode(Publisher<?> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) {
throw new UnsupportedOperationException("Does not support stream encoding yet");
}
}

View File

@ -203,22 +203,18 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue
* Add {@link MediaType} objects to be supported by this converter.
* <p>The supplied {@code MediaType} objects will be appended to the list
* of {@linkplain #getSupportedMediaTypes() supported MediaType objects}.
* @param supportedMediaTypes a var-args list of {@code MediaType} objects
* to add
* @param supportedMediaTypes a var-args list of {@code MediaType} objects to add
* @since 5.2
* @see #setSupportedMediaTypes(List)
*/
public void addSupportedMediaTypes(MediaType... supportedMediaTypes) {
Assert.notNull(supportedMediaTypes, "'supportedMediaTypes' must not be null");
Assert.noNullElements(supportedMediaTypes, "'supportedMediaTypes' must not contain null elements");
for (MediaType mediaType : supportedMediaTypes) {
this.supportedMediaTypes.add(mediaType);
}
Collections.addAll(this.supportedMediaTypes, supportedMediaTypes);
}
/**
* {@inheritDoc}
*
* @see #setSupportedMediaTypes(List)
* @see #addSupportedMediaTypes(MediaType...)
*/

View File

@ -148,18 +148,15 @@ public interface PathContainer {
*/
public final static Options MESSAGE_ROUTE = Options.create('.', false);
private final char separator;
private final boolean decodeAndParseSegments;
private Options(char separator, boolean decodeAndParseSegments) {
this.separator = separator;
this.decodeAndParseSegments = decodeAndParseSegments;
}
public char separator() {
return this.separator;
}
@ -168,7 +165,6 @@ public interface PathContainer {
return this.decodeAndParseSegments;
}
/**
* Create an {@link Options} instance with the given settings.
* @param separator the separator for parsing the path into segments;

View File

@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.filter.reactive;
import java.util.Optional;

View File

@ -38,10 +38,14 @@ import org.springframework.web.server.WebHandler;
*/
public class ExceptionHandlingWebHandler extends WebHandlerDecorator {
private final List<WebExceptionHandler> exceptionHandlers;
/**
* Create an {@code ExceptionHandlingWebHandler} for the given delegate.
* @param delegate the WebHandler delegate
* @param handlers the WebExceptionHandlers to apply
*/
public ExceptionHandlingWebHandler(WebHandler delegate, List<WebExceptionHandler> handlers) {
super(delegate);
List<WebExceptionHandler> handlersToUse = new ArrayList<>();
@ -61,7 +65,6 @@ public class ExceptionHandlingWebHandler extends WebHandlerDecorator {
@Override
public Mono<Void> handle(ServerWebExchange exchange) {
Mono<Void> completion;
try {
completion = super.handle(exchange);
@ -73,7 +76,6 @@ public class ExceptionHandlingWebHandler extends WebHandlerDecorator {
for (WebExceptionHandler handler : this.exceptionHandlers) {
completion = completion.onErrorResume(ex -> handler.handle(exchange, ex));
}
return completion;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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.
@ -33,12 +33,19 @@ public class WebHandlerDecorator implements WebHandler {
private final WebHandler delegate;
/**
* Create a {@code WebHandlerDecorator} for the given delegate.
* @param delegate the WebHandler delegate
*/
public WebHandlerDecorator(WebHandler delegate) {
Assert.notNull(delegate, "'delegate' must not be null");
this.delegate = delegate;
}
/**
* Return the wrapped delegate.
*/
public WebHandler getDelegate() {
return this.delegate;
}

View File

@ -136,7 +136,7 @@ public interface UriBuilder {
* only (i.e. {@code ?foo} instead of {@code ?foo=bar}.
* @param name the query parameter name
* @param values the query parameter values
* @since 5.2.0
* @since 5.2
* @see #queryParam(String, Object...)
*/
UriBuilder queryParam(String name, @Nullable Collection<?> values);
@ -161,7 +161,7 @@ public interface UriBuilder {
* the same parameter. If no values are given, the query parameter is removed.
* @param name the query parameter name
* @param values the query parameter values
* @since 5.2.0
* @since 5.2
* @see #replaceQueryParam(String, Object...)
*/
UriBuilder replaceQueryParam(String name, @Nullable Collection<?> values);

View File

@ -725,7 +725,7 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
* @param name the query parameter name
* @param values the query parameter values
* @return this UriComponentsBuilder
* @since 5.2.0
* @since 5.2
* @see #queryParam(String, Object...)
*/
@Override
@ -773,7 +773,7 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
* @param values the query parameter values
* @return this UriComponentsBuilder
* @see #replaceQueryParam(String, Object...)
* @since 5.2.0
* @since 5.2
*/
@Override
public UriComponentsBuilder replaceQueryParam(String name, @Nullable Collection<?> values) {

View File

@ -176,7 +176,6 @@ public class PathPattern implements Comparable<PathPattern> {
return this.patternString;
}
/**
* Whether the pattern string contains pattern syntax that would require
* use of {@link #matches(PathContainer)}, or if it is a regular String that
@ -184,7 +183,7 @@ public class PathPattern implements Comparable<PathPattern> {
* @since 5.2
*/
public boolean hasPatternSyntax() {
return this.score > 0 || this.patternString.indexOf('?') != -1;
return (this.score > 0 || this.patternString.indexOf('?') != -1);
}
/**
@ -218,9 +217,9 @@ public class PathPattern implements Comparable<PathPattern> {
@Nullable
public PathMatchInfo matchAndExtract(PathContainer pathContainer) {
if (this.head == null) {
return hasLength(pathContainer) &&
!(this.matchOptionalTrailingSeparator && pathContainerIsJustSeparator(pathContainer))
? null : PathMatchInfo.EMPTY;
return (hasLength(pathContainer) &&
!(this.matchOptionalTrailingSeparator && pathContainerIsJustSeparator(pathContainer)) ?
null : PathMatchInfo.EMPTY);
}
else if (!hasLength(pathContainer)) {
if (this.head instanceof WildcardTheRestPathElement || this.head instanceof CaptureTheRestPathElement) {
@ -442,6 +441,7 @@ public class PathPattern implements Comparable<PathPattern> {
return this.patternString;
}
int getScore() {
return this.score;
}
@ -537,30 +537,25 @@ public class PathPattern implements Comparable<PathPattern> {
pathContainer.value().charAt(0) == getSeparator();
}
/**
* Holder for URI variables and path parameters (matrix variables) extracted
* based on the pattern for a given matched path.
*/
public static class PathMatchInfo {
private static final PathMatchInfo EMPTY =
new PathMatchInfo(Collections.emptyMap(), Collections.emptyMap());
private static final PathMatchInfo EMPTY = new PathMatchInfo(Collections.emptyMap(), Collections.emptyMap());
private final Map<String, String> uriVariables;
private final Map<String, MultiValueMap<String, String>> matrixVariables;
PathMatchInfo(Map<String, String> uriVars,
@Nullable Map<String, MultiValueMap<String, String>> matrixVars) {
PathMatchInfo(Map<String, String> uriVars, @Nullable Map<String, MultiValueMap<String, String>> matrixVars) {
this.uriVariables = Collections.unmodifiableMap(uriVars);
this.matrixVariables = matrixVars != null ?
Collections.unmodifiableMap(matrixVars) : Collections.emptyMap();
this.matrixVariables = (matrixVars != null ?
Collections.unmodifiableMap(matrixVars) : Collections.emptyMap());
}
/**
* Return the extracted URI variables.
*/
@ -717,4 +712,5 @@ public class PathPattern implements Comparable<PathPattern> {
return "";
}
}
}

View File

@ -154,8 +154,9 @@ public abstract class BodyInserters {
* @return the inserter to write a producer
* @since 5.2
*/
public static <T> BodyInserter<T, ReactiveHttpOutputMessage> fromProducer(T producer,
ParameterizedTypeReference<?> elementTypeRef) {
public static <T> BodyInserter<T, ReactiveHttpOutputMessage> fromProducer(
T producer, ParameterizedTypeReference<?> elementTypeRef) {
Assert.notNull(producer, "'producer' must not be null");
Assert.notNull(elementTypeRef, "'elementTypeRef' must not be null");
ReactiveAdapter adapter = ReactiveAdapterRegistry.getSharedInstance().getAdapter(producer.getClass());

View File

@ -91,9 +91,7 @@ public interface EntityResponse<T> extends ServerResponse {
* @return the created builder
* @since 5.2
*/
static <T> Builder<T> fromProducer(T producer,
ParameterizedTypeReference<?> typeReference) {
static <T> Builder<T> fromProducer(T producer, ParameterizedTypeReference<?> typeReference) {
return new DefaultEntityResponseBuilder<>(producer,
BodyInserters.fromProducer(producer, typeReference));
}

View File

@ -444,7 +444,6 @@ public abstract class RouterFunctions {
/**
* Adds a route to the given handler function that handles all requests that match the
* given predicate.
*
* @param predicate the request predicate to match
* @param handlerFunction the handler function to handle all requests that match the predicate
* @return this builder

View File

@ -212,7 +212,7 @@ public abstract class AbstractHandlerMapping extends ApplicationObjectSupport
* @since 5.2
*/
protected boolean hasCorsConfigurationSource(Object handler) {
return handler instanceof CorsConfigurationSource || this.corsConfigurationSource != null;
return (handler instanceof CorsConfigurationSource || this.corsConfigurationSource != null);
}
/**

View File

@ -58,7 +58,6 @@ public class SimpleUrlHandlerMapping extends AbstractUrlHandlerMapping {
/**
* Create a {@code SimpleUrlHandlerMapping} with default settings.
* @since 5.2
*/
public SimpleUrlHandlerMapping() {
}

View File

@ -45,9 +45,7 @@ import org.springframework.web.server.ServerWebInputException;
*/
public class RequestBodyMethodArgumentResolver extends AbstractMessageReaderArgumentResolver {
public RequestBodyMethodArgumentResolver(List<HttpMessageReader<?>> readers,
ReactiveAdapterRegistry registry) {
public RequestBodyMethodArgumentResolver(List<HttpMessageReader<?>> readers, ReactiveAdapterRegistry registry) {
super(readers, registry);
}

View File

@ -276,8 +276,8 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping(
ContentNegotiationManager mvcContentNegotiationManager,
FormattingConversionService mvcConversionService,
ResourceUrlProvider mvcResourceUrlProvider) {
FormattingConversionService mvcConversionService, ResourceUrlProvider mvcResourceUrlProvider) {
RequestMappingHandlerMapping mapping = createRequestMappingHandlerMapping();
mapping.setOrder(0);
mapping.setInterceptors(getInterceptors(mvcConversionService, mvcResourceUrlProvider));
@ -477,8 +477,9 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
* paths to controller bean names.
*/
@Bean
public BeanNameUrlHandlerMapping beanNameHandlerMapping(FormattingConversionService mvcConversionService,
ResourceUrlProvider mvcResourceUrlProvider) {
public BeanNameUrlHandlerMapping beanNameHandlerMapping(
FormattingConversionService mvcConversionService, ResourceUrlProvider mvcResourceUrlProvider) {
BeanNameUrlHandlerMapping mapping = new BeanNameUrlHandlerMapping();
mapping.setOrder(2);
mapping.setInterceptors(getInterceptors(mvcConversionService, mvcResourceUrlProvider));
@ -498,8 +499,9 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
* @since 5.2
*/
@Bean
public RouterFunctionMapping routerFunctionMapping(FormattingConversionService mvcConversionService,
ResourceUrlProvider mvcResourceUrlProvider) {
public RouterFunctionMapping routerFunctionMapping(
FormattingConversionService mvcConversionService, ResourceUrlProvider mvcResourceUrlProvider) {
RouterFunctionMapping mapping = new RouterFunctionMapping();
mapping.setOrder(3);
mapping.setInterceptors(getInterceptors(mvcConversionService, mvcResourceUrlProvider));
@ -516,10 +518,9 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
@Bean
@Nullable
public HandlerMapping resourceHandlerMapping(UrlPathHelper mvcUrlPathHelper,
PathMatcher mvcPathMatcher,
ContentNegotiationManager mvcContentNegotiationManager,
FormattingConversionService mvcConversionService,
ResourceUrlProvider mvcResourceUrlProvider) {
PathMatcher mvcPathMatcher, ContentNegotiationManager mvcContentNegotiationManager,
FormattingConversionService mvcConversionService, ResourceUrlProvider mvcResourceUrlProvider) {
Assert.state(this.applicationContext != null, "No ApplicationContext set");
Assert.state(this.servletContext != null, "No ServletContext set");
@ -597,8 +598,8 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
@Bean
public RequestMappingHandlerAdapter requestMappingHandlerAdapter(
ContentNegotiationManager mvcContentNegotiationManager,
FormattingConversionService mvcConversionService,
Validator mvcValidator) {
FormattingConversionService mvcConversionService, Validator mvcValidator) {
RequestMappingHandlerAdapter adapter = createRequestMappingHandlerAdapter();
adapter.setContentNegotiationManager(mvcContentNegotiationManager);
adapter.setMessageConverters(getMessageConverters());
@ -649,8 +650,8 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
* initializing all {@link WebDataBinder} instances.
*/
protected ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer(
FormattingConversionService mvcConversionService,
Validator mvcValidator) {
FormattingConversionService mvcConversionService, Validator mvcValidator) {
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
initializer.setConversionService(mvcConversionService);
initializer.setValidator(mvcValidator);
@ -980,6 +981,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
*/
protected final void addDefaultHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers,
ContentNegotiationManager mvcContentNegotiationManager) {
ExceptionHandlerExceptionResolver exceptionHandlerResolver = createExceptionHandlerExceptionResolver();
exceptionHandlerResolver.setContentNegotiationManager(mvcContentNegotiationManager);
exceptionHandlerResolver.setMessageConverters(getMessageConverters());
@ -1025,8 +1027,8 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
*/
@Bean
public ViewResolver mvcViewResolver(ContentNegotiationManager mvcContentNegotiationManager) {
ViewResolverRegistry registry = new ViewResolverRegistry(
mvcContentNegotiationManager, this.applicationContext);
ViewResolverRegistry registry =
new ViewResolverRegistry(mvcContentNegotiationManager, this.applicationContext);
configureViewResolvers(registry);
if (registry.getViewResolvers().isEmpty() && this.applicationContext != null) {

View File

@ -485,7 +485,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
* @since 5.2
*/
protected boolean hasCorsConfigurationSource(Object handler) {
return handler instanceof CorsConfigurationSource || this.corsConfigurationSource != null;
return (handler instanceof CorsConfigurationSource || this.corsConfigurationSource != null);
}
/**

View File

@ -63,7 +63,6 @@ public class SimpleUrlHandlerMapping extends AbstractUrlHandlerMapping {
/**
* Create a {@code SimpleUrlHandlerMapping} with default settings.
* @since 5.2
*/
public SimpleUrlHandlerMapping() {
}

View File

@ -303,14 +303,14 @@ public abstract class AbstractCachingViewResolver extends WebApplicationObjectSu
public interface CacheFilter {
/**
* Indicates whether the given view should be cached. The name and
* locale used to resolve the view are also provided.
* Indicates whether the given view should be cached.
* The name and locale used to resolve the view are also provided.
* @param view the view
* @param viewName the name used to resolve {@code view}
* @param locale the locale used to resolve {@code view}
* @return {@code true} if the view should be cached; {@code false}
* otherwise
* @param viewName the name used to resolve the {@code view}
* @param locale the locale used to resolve the {@code view}
* @return {@code true} if the view should be cached; {@code false} otherwise
*/
boolean filter(View view, String viewName, Locale locale);
}
}

View File

@ -652,6 +652,7 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
return MessageBuilder.createMessage(EMPTY_PAYLOAD, headerAccessor.getMessageHeaders());
}
@Override
public String toString() {
return "StompSubProtocolHandler" + getSupportedProtocols();
@ -689,7 +690,6 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
private final AtomicInteger disconnect = new AtomicInteger();
public void incrementConnectCount() {
this.connect.incrementAndGet();
}

View File

@ -595,6 +595,7 @@ public class SubProtocolWebSocketHandler
int getTransportErrorSessions();
}
private class DefaultStats implements Stats {
private final AtomicInteger total = new AtomicInteger();
@ -611,7 +612,6 @@ public class SubProtocolWebSocketHandler
private final AtomicInteger transportError = new AtomicInteger();
@Override
public int getTotalSessions() {
return this.total.get();