Polishing

This commit is contained in:
Juergen Hoeller 2021-12-03 22:36:31 +01:00
parent d7e0eed8d2
commit 14f24f43d7
12 changed files with 31 additions and 43 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -34,9 +34,7 @@ import org.springframework.lang.Nullable;
* *
* <p><b>NOTE:</b> This interface is a special purpose interface, mainly for * <p><b>NOTE:</b> This interface is a special purpose interface, mainly for
* internal use within the framework. It is recommended to implement the plain * internal use within the framework. It is recommended to implement the plain
* {@link BeanPostProcessor} interface as far as possible, or to derive from * {@link BeanPostProcessor} interface as far as possible.
* {@link InstantiationAwareBeanPostProcessorAdapter} in order to be shielded
* from extensions to this interface.
* *
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Rod Johnson * @author Rod Johnson

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -79,7 +79,7 @@ public abstract class AbstractFallbackJCacheOperationSource implements JCacheOpe
@Nullable @Nullable
private JCacheOperation<?> computeCacheOperation(Method method, @Nullable Class<?> targetClass) { private JCacheOperation<?> computeCacheOperation(Method method, @Nullable Class<?> targetClass) {
// Don't allow no-public methods as required. // Don't allow non-public methods, as configured.
if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) { if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) {
return null; return null;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -124,7 +124,7 @@ public abstract class AbstractFallbackCacheOperationSource implements CacheOpera
@Nullable @Nullable
private Collection<CacheOperation> computeCacheOperations(Method method, @Nullable Class<?> targetClass) { private Collection<CacheOperation> computeCacheOperations(Method method, @Nullable Class<?> targetClass) {
// Don't allow no-public methods as required. // Don't allow non-public methods, as configured.
if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) { if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) {
return null; return null;
} }

View File

@ -26,9 +26,7 @@ import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
/** /**
@ -65,7 +63,7 @@ import org.springframework.lang.Nullable;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ThreadPoolExecutorFactoryBean extends ExecutorConfigurationSupport public class ThreadPoolExecutorFactoryBean extends ExecutorConfigurationSupport
implements FactoryBean<ExecutorService>, InitializingBean, DisposableBean { implements FactoryBean<ExecutorService> {
private int corePoolSize = 1; private int corePoolSize = 1;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -193,7 +193,7 @@ public class ContentRequestMatchers {
* <li>{@link Resource} - content from a file * <li>{@link Resource} - content from a file
* <li>{@code byte[]} - other raw content * <li>{@code byte[]} - other raw content
* </ul> * </ul>
* <p><strong>Note:</strong> This method uses the Apache Commons File Upload * <p><strong>Note:</strong> This method uses the Apache Commons FileUpload
* library to parse the multipart data and it must be on the test classpath. * library to parse the multipart data and it must be on the test classpath.
* @param expectedMap the expected multipart values * @param expectedMap the expected multipart values
* @since 5.3 * @since 5.3

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -163,7 +163,7 @@ public abstract class AbstractFallbackTransactionAttributeSource
*/ */
@Nullable @Nullable
protected TransactionAttribute computeTransactionAttribute(Method method, @Nullable Class<?> targetClass) { protected TransactionAttribute computeTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
// Don't allow no-public methods as required. // Don't allow non-public methods, as configured.
if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) { if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) {
return null; return null;
} }

View File

@ -254,7 +254,7 @@ public abstract class AbstractListenerWriteProcessor<T> implements Processor<T,
* the next item from the upstream, write Publisher. * the next item from the upstream, write Publisher.
* <p>The default implementation is a no-op. * <p>The default implementation is a no-op.
* @deprecated originally introduced for Undertow to stop write notifications * @deprecated originally introduced for Undertow to stop write notifications
* when no data is available, but deprecated as of as of 5.0.6 since constant * when no data is available, but deprecated as of 5.0.6 since constant
* switching on every requested item causes a significant slowdown. * switching on every requested item causes a significant slowdown.
*/ */
@Deprecated @Deprecated

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -54,9 +54,9 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
* of the {@code Filter.init} and {@code Filter.destroy} lifecycle methods * of the {@code Filter.init} and {@code Filter.destroy} lifecycle methods
* on the target bean, letting the servlet container manage the filter lifecycle. * on the target bean, letting the servlet container manage the filter lifecycle.
* *
* <p>As of Spring 3.1, {@code DelegatingFilterProxy} has been updated to optionally accept * <p>As of Spring 3.1, {@code DelegatingFilterProxy} has been updated to optionally
* constructor parameters when using Servlet 3.0's instance-based filter registration * accept constructor parameters when using a Servlet container's instance-based filter
* methods, usually in conjunction with Spring 3.1's * registration methods, usually in conjunction with Spring's
* {@link org.springframework.web.WebApplicationInitializer} SPI. These constructors allow * {@link org.springframework.web.WebApplicationInitializer} SPI. These constructors allow
* for providing the delegate Filter bean directly, or providing the application context * for providing the delegate Filter bean directly, or providing the application context
* and bean name to fetch, avoiding the need to look up the application context from the * and bean name to fetch, avoiding the need to look up the application context from the
@ -100,8 +100,7 @@ public class DelegatingFilterProxy extends GenericFilterBean {
/** /**
* Create a new {@code DelegatingFilterProxy}. For traditional (pre-Servlet 3.0) use * Create a new {@code DelegatingFilterProxy}. For traditional use in {@code web.xml}.
* in {@code web.xml}.
* @see #setTargetBeanName(String) * @see #setTargetBeanName(String)
*/ */
public DelegatingFilterProxy() { public DelegatingFilterProxy() {
@ -111,8 +110,7 @@ public class DelegatingFilterProxy extends GenericFilterBean {
* Create a new {@code DelegatingFilterProxy} with the given {@link Filter} delegate. * Create a new {@code DelegatingFilterProxy} with the given {@link Filter} delegate.
* Bypasses entirely the need for interacting with a Spring application context, * Bypasses entirely the need for interacting with a Spring application context,
* specifying the {@linkplain #setTargetBeanName target bean name}, etc. * specifying the {@linkplain #setTargetBeanName target bean name}, etc.
* <p>For use in Servlet 3.0+ environments where instance-based registration of * <p>For use with instance-based registration of filters.
* filters is supported.
* @param delegate the {@code Filter} instance that this proxy will delegate to and * @param delegate the {@code Filter} instance that this proxy will delegate to and
* manage the lifecycle for (must not be {@code null}). * manage the lifecycle for (must not be {@code null}).
* @see #doFilter(ServletRequest, ServletResponse, FilterChain) * @see #doFilter(ServletRequest, ServletResponse, FilterChain)
@ -130,9 +128,8 @@ public class DelegatingFilterProxy extends GenericFilterBean {
* bean from the Spring {@code WebApplicationContext} found in the {@code ServletContext} * bean from the Spring {@code WebApplicationContext} found in the {@code ServletContext}
* (either the 'root' application context or the context named by * (either the 'root' application context or the context named by
* {@link #setContextAttribute}). * {@link #setContextAttribute}).
* <p>For use in Servlet 3.0+ environments where instance-based registration of * <p>For use with instance-based registration of filters.
* filters is supported. * <p>The target bean must implement the standard Servlet Filter interface.
* <p>The target bean must implement the standard Servlet Filter.
* @param targetBeanName name of the target filter bean to look up in the Spring * @param targetBeanName name of the target filter bean to look up in the Spring
* application context (must not be {@code null}). * application context (must not be {@code null}).
* @see #findWebApplicationContext() * @see #findWebApplicationContext()
@ -145,8 +142,7 @@ public class DelegatingFilterProxy extends GenericFilterBean {
/** /**
* Create a new {@code DelegatingFilterProxy} that will retrieve the named target * Create a new {@code DelegatingFilterProxy} that will retrieve the named target
* bean from the given Spring {@code WebApplicationContext}. * bean from the given Spring {@code WebApplicationContext}.
* <p>For use in Servlet 3.0+ environments where instance-based registration of * <p>For use with instance-based registration of filters.
* filters is supported.
* <p>The target bean must implement the standard Servlet Filter interface. * <p>The target bean must implement the standard Servlet Filter interface.
* <p>The given {@code WebApplicationContext} may or may not be refreshed when passed * <p>The given {@code WebApplicationContext} may or may not be refreshed when passed
* in. If it has not, and if the context implements {@link ConfigurableApplicationContext}, * in. If it has not, and if the context implements {@link ConfigurableApplicationContext},

View File

@ -98,12 +98,10 @@ public abstract class OncePerRequestFilter extends GenericFilterBean {
boolean hasAlreadyFilteredAttribute = request.getAttribute(alreadyFilteredAttributeName) != null; boolean hasAlreadyFilteredAttribute = request.getAttribute(alreadyFilteredAttributeName) != null;
if (skipDispatch(httpRequest) || shouldNotFilter(httpRequest)) { if (skipDispatch(httpRequest) || shouldNotFilter(httpRequest)) {
// Proceed without invoking this filter... // Proceed without invoking this filter...
filterChain.doFilter(request, response); filterChain.doFilter(request, response);
} }
else if (hasAlreadyFilteredAttribute) { else if (hasAlreadyFilteredAttribute) {
if (DispatcherType.ERROR.equals(request.getDispatcherType())) { if (DispatcherType.ERROR.equals(request.getDispatcherType())) {
doFilterNestedErrorDispatch(httpRequest, httpResponse, filterChain); doFilterNestedErrorDispatch(httpRequest, httpResponse, filterChain);
return; return;
@ -197,7 +195,7 @@ public abstract class OncePerRequestFilter extends GenericFilterBean {
* setting up thread locals or to perform final processing at the very end. * setting up thread locals or to perform final processing at the very end.
* <p>Note that although a filter can be mapped to handle specific dispatcher * <p>Note that although a filter can be mapped to handle specific dispatcher
* types via {@code web.xml} or in Java through the {@code ServletContext}, * types via {@code web.xml} or in Java through the {@code ServletContext},
* servlet containers may enforce different defaults with regards to * servlet containers may enforce different defaults with respect to
* dispatcher types. This flag enforces the design intent of the filter. * dispatcher types. This flag enforces the design intent of the filter.
* <p>The default return value is "true", which means the filter will not be * <p>The default return value is "true", which means the filter will not be
* invoked during subsequent async dispatches. If "false", the filter will * invoked during subsequent async dispatches. If "false", the filter will

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,7 +28,7 @@ import org.springframework.http.MediaType;
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 5.0 * @since 5.0
* @deprecated in favor of {@link UnsupportedMediaTypeStatusException}, * @deprecated in favor of {@link UnsupportedMediaTypeStatusException},
* with this class never thrown by Spring code and to be removed in 5.3 * with this class never thrown by Spring code and to be removed in 6.0
*/ */
@Deprecated @Deprecated
@SuppressWarnings("serial") @SuppressWarnings("serial")

View File

@ -48,7 +48,6 @@ import org.springframework.lang.Nullable;
* <p>Used e.g. by {@link org.springframework.web.filter.AbstractRequestLoggingFilter}. * <p>Used e.g. by {@link org.springframework.web.filter.AbstractRequestLoggingFilter}.
* Note: As of Spring Framework 5.0, this wrapper is built on the Servlet 3.1 API. * Note: As of Spring Framework 5.0, this wrapper is built on the Servlet 3.1 API.
* *
*
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Brian Clozel * @author Brian Clozel
* @since 4.1.3 * @since 4.1.3

View File

@ -103,14 +103,6 @@ public class HandlerMappingIntrospector
} }
/**
* Return the configured or detected {@code HandlerMapping}s.
*/
public List<HandlerMapping> getHandlerMappings() {
return (this.handlerMappings != null ? this.handlerMappings : Collections.emptyList());
}
@Override @Override
public void setApplicationContext(ApplicationContext applicationContext) { public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext; this.applicationContext = applicationContext;
@ -125,6 +117,13 @@ public class HandlerMappingIntrospector
} }
} }
/**
* Return the configured or detected {@code HandlerMapping}s.
*/
public List<HandlerMapping> getHandlerMappings() {
return (this.handlerMappings != null ? this.handlerMappings : Collections.emptyList());
}
/** /**
* Find the {@link HandlerMapping} that would handle the given request and * Find the {@link HandlerMapping} that would handle the given request and