Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -248,8 +248,8 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
||||
|
||||
/**
|
||||
* If a pointcut expression has been specified in XML, the user cannot
|
||||
* write {@code and} as "&&" (though && will work).
|
||||
* We also allow {@code and} between two pointcut sub-expressions.
|
||||
* write "and" as "&&" (though {@code &&} will work).
|
||||
* <p>We also allow "and" between two pointcut sub-expressions.
|
||||
* <p>This method converts back to {@code &&} for the AspectJ pointcut parser.
|
||||
*/
|
||||
private String replaceBooleanOperators(String pcExpr) {
|
||||
@@ -527,7 +527,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
||||
return false;
|
||||
}
|
||||
AspectJExpressionPointcut otherPc = (AspectJExpressionPointcut) other;
|
||||
return ObjectUtils.nullSafeEquals(this.getExpression(), otherPc.getExpression()) &&
|
||||
return ObjectUtils.nullSafeEquals(getExpression(), otherPc.getExpression()) &&
|
||||
ObjectUtils.nullSafeEquals(this.pointcutDeclarationScope, otherPc.pointcutDeclarationScope) &&
|
||||
ObjectUtils.nullSafeEquals(this.pointcutParameterNames, otherPc.pointcutParameterNames) &&
|
||||
ObjectUtils.nullSafeEquals(this.pointcutParameterTypes, otherPc.pointcutParameterTypes);
|
||||
@@ -535,7 +535,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashCode = ObjectUtils.nullSafeHashCode(this.getExpression());
|
||||
int hashCode = ObjectUtils.nullSafeHashCode(getExpression());
|
||||
hashCode = 31 * hashCode + ObjectUtils.nullSafeHashCode(this.pointcutDeclarationScope);
|
||||
hashCode = 31 * hashCode + ObjectUtils.nullSafeHashCode(this.pointcutParameterNames);
|
||||
hashCode = 31 * hashCode + ObjectUtils.nullSafeHashCode(this.pointcutParameterTypes);
|
||||
|
||||
@@ -424,10 +424,9 @@ class CglibAopProxy implements AopProxy, Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* Method interceptor used for static targets with no advice chain. The call
|
||||
* is passed directly back to the target. Used when the proxy needs to be
|
||||
* exposed and it can't be determined that the method won't return
|
||||
* {@code this}.
|
||||
* Method interceptor used for static targets with no advice chain. The call is
|
||||
* passed directly back to the target. Used when the proxy needs to be exposed
|
||||
* and it can't be determined that the method won't return {@code this}.
|
||||
*/
|
||||
private static class StaticUnadvisedInterceptor implements MethodInterceptor, Serializable {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -112,7 +112,7 @@ public class LookupOverride extends MethodOverride {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (29 * super.hashCode() + ObjectUtils.nullSafeHashCode(this.beanName));
|
||||
return super.hashCode() * 29 + ObjectUtils.nullSafeHashCode(this.beanName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -477,7 +477,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.age;
|
||||
return TestBean.class.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -65,7 +65,7 @@ public class AnnotationConfigApplicationContext extends GenericApplicationContex
|
||||
* through {@link #register} calls and then manually {@linkplain #refresh refreshed}.
|
||||
*/
|
||||
public AnnotationConfigApplicationContext() {
|
||||
StartupStep createAnnotatedBeanDefReader = this.getApplicationStartup().start("spring.context.annotated-bean-reader.create");
|
||||
StartupStep createAnnotatedBeanDefReader = getApplicationStartup().start("spring.context.annotated-bean-reader.create");
|
||||
this.reader = new AnnotatedBeanDefinitionReader(this);
|
||||
createAnnotatedBeanDefReader.end();
|
||||
this.scanner = new ClassPathBeanDefinitionScanner(this);
|
||||
@@ -163,7 +163,7 @@ public class AnnotationConfigApplicationContext extends GenericApplicationContex
|
||||
@Override
|
||||
public void register(Class<?>... componentClasses) {
|
||||
Assert.notEmpty(componentClasses, "At least one component class must be specified");
|
||||
StartupStep registerComponentClass = this.getApplicationStartup().start("spring.context.component-classes.register")
|
||||
StartupStep registerComponentClass = getApplicationStartup().start("spring.context.component-classes.register")
|
||||
.tag("classes", () -> Arrays.toString(componentClasses));
|
||||
this.reader.register(componentClasses);
|
||||
registerComponentClass.end();
|
||||
@@ -180,7 +180,7 @@ public class AnnotationConfigApplicationContext extends GenericApplicationContex
|
||||
@Override
|
||||
public void scan(String... basePackages) {
|
||||
Assert.notEmpty(basePackages, "At least one base package must be specified");
|
||||
StartupStep scanPackages = this.getApplicationStartup().start("spring.context.base-packages.scan")
|
||||
StartupStep scanPackages = getApplicationStartup().start("spring.context.base-packages.scan")
|
||||
.tag("packages", () -> Arrays.toString(basePackages));
|
||||
this.scanner.scan(basePackages);
|
||||
scanPackages.end();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -20,6 +20,7 @@ import java.io.IOException;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionDocumentReader;
|
||||
import org.springframework.beans.factory.xml.ResourceEntityResolver;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -84,7 +85,7 @@ public abstract class AbstractXmlApplicationContext extends AbstractRefreshableC
|
||||
|
||||
// Configure the bean definition reader with this context's
|
||||
// resource loading environment.
|
||||
beanDefinitionReader.setEnvironment(this.getEnvironment());
|
||||
beanDefinitionReader.setEnvironment(getEnvironment());
|
||||
beanDefinitionReader.setResourceLoader(this);
|
||||
beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));
|
||||
|
||||
@@ -95,12 +96,13 @@ public abstract class AbstractXmlApplicationContext extends AbstractRefreshableC
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the bean definition reader used for loading the bean
|
||||
* definitions of this context. Default implementation is empty.
|
||||
* Initialize the bean definition reader used for loading the bean definitions
|
||||
* of this context. The default implementation sets the validating flag.
|
||||
* <p>Can be overridden in subclasses, e.g. for turning off XML validation
|
||||
* or using a different XmlBeanDefinitionParser implementation.
|
||||
* or using a different {@link BeanDefinitionDocumentReader} implementation.
|
||||
* @param reader the bean definition reader used by this context
|
||||
* @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader#setDocumentReaderClass
|
||||
* @see XmlBeanDefinitionReader#setValidating
|
||||
* @see XmlBeanDefinitionReader#setDocumentReaderClass
|
||||
*/
|
||||
protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
|
||||
reader.setValidating(this.validating);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -252,7 +252,7 @@ public abstract class CommandLinePropertySource<T> extends EnumerablePropertySou
|
||||
@Override
|
||||
public final boolean containsProperty(String name) {
|
||||
if (this.nonOptionArgsPropertyName.equals(name)) {
|
||||
return !this.getNonOptionArgs().isEmpty();
|
||||
return !getNonOptionArgs().isEmpty();
|
||||
}
|
||||
return this.containsOption(name);
|
||||
}
|
||||
@@ -270,7 +270,7 @@ public abstract class CommandLinePropertySource<T> extends EnumerablePropertySou
|
||||
@Nullable
|
||||
public final String getProperty(String name) {
|
||||
if (this.nonOptionArgsPropertyName.equals(name)) {
|
||||
Collection<String> nonOptionArguments = this.getNonOptionArgs();
|
||||
Collection<String> nonOptionArguments = getNonOptionArgs();
|
||||
if (nonOptionArguments.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -278,7 +278,7 @@ public abstract class CommandLinePropertySource<T> extends EnumerablePropertySou
|
||||
return StringUtils.collectionToCommaDelimitedString(nonOptionArguments);
|
||||
}
|
||||
}
|
||||
Collection<String> optionValues = this.getOptionValues(name);
|
||||
Collection<String> optionValues = getOptionValues(name);
|
||||
if (optionValues == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -752,28 +752,27 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (this.key + "=" + this.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public final boolean equals(@Nullable Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof Map.Entry)) {
|
||||
if (!(other instanceof Map.Entry<?, ?>)) {
|
||||
return false;
|
||||
}
|
||||
Map.Entry otherEntry = (Map.Entry) other;
|
||||
Map.Entry<?, ?> otherEntry = (Map.Entry<?, ?>) other;
|
||||
return (ObjectUtils.nullSafeEquals(getKey(), otherEntry.getKey()) &&
|
||||
ObjectUtils.nullSafeEquals(getValue(), otherEntry.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
public int hashCode() {
|
||||
return (ObjectUtils.nullSafeHashCode(this.key) ^ ObjectUtils.nullSafeHashCode(this.value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (this.key + "=" + this.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -85,7 +85,7 @@ public class NullSafeComparator<T> implements Comparator<T> {
|
||||
* @param nullsLow whether to treat nulls lower or higher than non-null objects
|
||||
*/
|
||||
public NullSafeComparator(Comparator<T> comparator, boolean nullsLow) {
|
||||
Assert.notNull(comparator, "Non-null Comparator is required");
|
||||
Assert.notNull(comparator, "Comparator must not be null");
|
||||
this.nonNullComparator = comparator;
|
||||
this.nullsLow = nullsLow;
|
||||
}
|
||||
@@ -107,16 +107,16 @@ public class NullSafeComparator<T> implements Comparator<T> {
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof NullSafeComparator)) {
|
||||
if (!(other instanceof NullSafeComparator<?>)) {
|
||||
return false;
|
||||
}
|
||||
NullSafeComparator<T> otherComp = (NullSafeComparator<T>) other;
|
||||
return (this.nonNullComparator.equals(otherComp.nonNullComparator) && this.nullsLow == otherComp.nullsLow);
|
||||
NullSafeComparator<?> otherComp = (NullSafeComparator<?>) other;
|
||||
return (this.nonNullComparator.equals(otherComp.nonNullComparator) &&
|
||||
this.nullsLow == otherComp.nullsLow);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -28,7 +28,7 @@ import org.springframework.core.env.PropertySource;
|
||||
*
|
||||
* The {@link #setProperty} and {@link #withProperty} methods are exposed for
|
||||
* convenience, for example:
|
||||
* <pre>
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* PropertySource<?> source = new MockPropertySource().withProperty("foo", "bar");
|
||||
* }
|
||||
@@ -77,7 +77,7 @@ public class MockPropertySource extends PropertiesPropertySource {
|
||||
|
||||
/**
|
||||
* Create a new {@code MockPropertySource} with the given name and backed by the given
|
||||
* {@link Properties} object
|
||||
* {@link Properties} object.
|
||||
* @param name the {@linkplain #getName() name} of the property source
|
||||
* @param properties the properties to use
|
||||
*/
|
||||
@@ -99,7 +99,7 @@ public class MockPropertySource extends PropertiesPropertySource {
|
||||
* @return this {@link MockPropertySource} instance
|
||||
*/
|
||||
public MockPropertySource withProperty(String name, Object value) {
|
||||
this.setProperty(name, value);
|
||||
setProperty(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -622,7 +622,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (31 * super.hashCode() + ObjectUtils.nullSafeHashCode(this.selector));
|
||||
return super.hashCode() * 31 + ObjectUtils.nullSafeHashCode(this.selector);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2023 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,8 +21,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
||||
|
||||
/**
|
||||
* Simple {@link ConfigurableEnvironment} implementation exposing
|
||||
* {@link #setProperty(String, String)} and {@link #withProperty(String, String)}
|
||||
* methods for testing purposes.
|
||||
* {@link #setProperty} and {@link #withProperty} methods for testing purposes.
|
||||
*
|
||||
* @author Chris Beams
|
||||
* @author Sam Brannen
|
||||
@@ -31,7 +30,8 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
||||
*/
|
||||
public class MockEnvironment extends AbstractEnvironment {
|
||||
|
||||
private MockPropertySource propertySource = new MockPropertySource();
|
||||
private final MockPropertySource propertySource = new MockPropertySource();
|
||||
|
||||
|
||||
/**
|
||||
* Create a new {@code MockEnvironment} with a single {@link MockPropertySource}.
|
||||
@@ -40,6 +40,7 @@ public class MockEnvironment extends AbstractEnvironment {
|
||||
getPropertySources().addLast(this.propertySource);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a property on the underlying {@link MockPropertySource} for this environment.
|
||||
*/
|
||||
@@ -54,7 +55,7 @@ public class MockEnvironment extends AbstractEnvironment {
|
||||
* @see MockPropertySource#withProperty
|
||||
*/
|
||||
public MockEnvironment withProperty(String key, String value) {
|
||||
this.setProperty(key, value);
|
||||
setProperty(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -48,6 +48,7 @@ public class MockPropertySource extends PropertiesPropertySource {
|
||||
*/
|
||||
public static final String MOCK_PROPERTIES_PROPERTY_SOURCE_NAME = "mockProperties";
|
||||
|
||||
|
||||
/**
|
||||
* Create a new {@code MockPropertySource} named {@value #MOCK_PROPERTIES_PROPERTY_SOURCE_NAME}
|
||||
* that will maintain its own internal {@link Properties} instance.
|
||||
@@ -84,6 +85,7 @@ public class MockPropertySource extends PropertiesPropertySource {
|
||||
super(name, properties);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the given property on the underlying {@link Properties} object.
|
||||
*/
|
||||
@@ -97,7 +99,7 @@ public class MockPropertySource extends PropertiesPropertySource {
|
||||
* @return this {@link MockPropertySource} instance
|
||||
*/
|
||||
public MockPropertySource withProperty(String name, Object value) {
|
||||
this.setProperty(name, value);
|
||||
setProperty(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,8 +159,8 @@ public class RollbackRuleAttribute implements Serializable{
|
||||
if (!(other instanceof RollbackRuleAttribute)) {
|
||||
return false;
|
||||
}
|
||||
RollbackRuleAttribute rhs = (RollbackRuleAttribute) other;
|
||||
return this.exceptionPattern.equals(rhs.exceptionPattern);
|
||||
RollbackRuleAttribute otherAttr = (RollbackRuleAttribute) other;
|
||||
return this.exceptionPattern.equals(otherAttr.exceptionPattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -56,11 +56,6 @@ public class HttpCookie {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.name.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
@@ -73,6 +68,11 @@ public class HttpCookie {
|
||||
return (this.name.equalsIgnoreCase(otherCookie.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.name.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name + '=' + this.value;
|
||||
|
||||
@@ -251,7 +251,7 @@ public class ServletContextResource extends AbstractFileResolvingResource implem
|
||||
return false;
|
||||
}
|
||||
ServletContextResource otherRes = (ServletContextResource) other;
|
||||
return (this.servletContext.equals(otherRes.servletContext) && this.path.equals(otherRes.path));
|
||||
return (this.path.equals(otherRes.path) && this.servletContext.equals(otherRes.servletContext));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -42,7 +42,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
* be delegated to that bean in the Spring context, which is required to implement
|
||||
* the standard Servlet Filter interface.
|
||||
*
|
||||
* <p>This approach is particularly useful for Filter implementation with complex
|
||||
* <p>This approach is particularly useful for Filter implementations with complex
|
||||
* setup needs, allowing to apply the full Spring bean definition machinery to
|
||||
* Filter instances. Alternatively, consider standard Filter setup in combination
|
||||
* with looking up service beans from the Spring root application context.
|
||||
@@ -52,11 +52,11 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
* Spring application context to manage the lifecycle of that bean. Specifying
|
||||
* the "targetFilterLifecycle" filter init-param as "true" will enforce invocation
|
||||
* 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 constructor parameters when using a Servlet container's instance-based filter
|
||||
* registration methods, usually in conjunction with Spring's
|
||||
* <p>{@code DelegatingFilterProxy} can optionally accept constructor parameters
|
||||
* when using a Servlet container's instance-based filter registration methods,
|
||||
* usually in conjunction with Spring's
|
||||
* {@link org.springframework.web.WebApplicationInitializer} SPI. These constructors allow
|
||||
* 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
|
||||
@@ -160,10 +160,10 @@ public class DelegatingFilterProxy extends GenericFilterBean {
|
||||
*/
|
||||
public DelegatingFilterProxy(String targetBeanName, @Nullable WebApplicationContext wac) {
|
||||
Assert.hasText(targetBeanName, "Target Filter bean name must not be null or empty");
|
||||
this.setTargetBeanName(targetBeanName);
|
||||
setTargetBeanName(targetBeanName);
|
||||
this.webApplicationContext = wac;
|
||||
if (wac != null) {
|
||||
this.setEnvironment(wac.getEnvironment());
|
||||
setEnvironment(wac.getEnvironment());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.StringJoiner;
|
||||
|
||||
import org.springframework.http.server.PathContainer;
|
||||
import org.springframework.http.server.PathContainer.Element;
|
||||
import org.springframework.http.server.PathContainer.PathSegment;
|
||||
import org.springframework.http.server.PathContainer.Separator;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -430,6 +431,9 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof PathPattern)) {
|
||||
return false;
|
||||
}
|
||||
@@ -600,13 +604,11 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||
|
||||
private final PathMatchInfo pathMatchInfo;
|
||||
|
||||
|
||||
PathRemainingMatchInfo(PathContainer pathMatched, PathContainer pathRemaining) {
|
||||
this(pathMatched, pathRemaining, PathMatchInfo.EMPTY);
|
||||
}
|
||||
|
||||
PathRemainingMatchInfo(PathContainer pathMatched, PathContainer pathRemaining,
|
||||
PathMatchInfo pathMatchInfo) {
|
||||
PathRemainingMatchInfo(PathContainer pathMatched, PathContainer pathRemaining, PathMatchInfo pathMatchInfo) {
|
||||
this.pathRemaining = pathRemaining;
|
||||
this.pathMatched = pathMatched;
|
||||
this.pathMatchInfo = pathMatchInfo;
|
||||
@@ -726,8 +728,8 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||
*/
|
||||
String pathElementValue(int pathIndex) {
|
||||
Element element = (pathIndex < this.pathLength) ? this.pathElements.get(pathIndex) : null;
|
||||
if (element instanceof PathContainer.PathSegment) {
|
||||
return ((PathContainer.PathSegment)element).valueToMatch();
|
||||
if (element instanceof PathSegment) {
|
||||
return ((PathSegment) element).valueToMatch();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -183,7 +183,7 @@ public abstract class ExchangeFilterFunctions {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 31 * this.username.hashCode() + this.password.hashCode();
|
||||
return this.username.hashCode() * 31 + this.password.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -18,6 +18,8 @@ package org.springframework.web.servlet.tags.form;
|
||||
|
||||
import java.beans.PropertyEditorSupport;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
@@ -50,7 +52,7 @@ public class ItemPet {
|
||||
return false;
|
||||
}
|
||||
ItemPet otherPet = (ItemPet) other;
|
||||
return (this.name != null && this.name.equals(otherPet.getName()));
|
||||
return ObjectUtils.nullSafeEquals(this.name, otherPet.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11061,7 +11061,7 @@ Here is an example of instrumentation in the `AnnotationConfigApplicationContext
|
||||
.Java
|
||||
----
|
||||
// create a startup step and start recording
|
||||
StartupStep scanPackages = this.getApplicationStartup().start("spring.context.base-packages.scan");
|
||||
StartupStep scanPackages = getApplicationStartup().start("spring.context.base-packages.scan");
|
||||
// add tagging information to the current step
|
||||
scanPackages.tag("packages", () -> Arrays.toString(basePackages));
|
||||
// perform the actual phase we're instrumenting
|
||||
@@ -11073,7 +11073,7 @@ Here is an example of instrumentation in the `AnnotationConfigApplicationContext
|
||||
.Kotlin
|
||||
----
|
||||
// create a startup step and start recording
|
||||
val scanPackages = this.getApplicationStartup().start("spring.context.base-packages.scan")
|
||||
val scanPackages = getApplicationStartup().start("spring.context.base-packages.scan")
|
||||
// add tagging information to the current step
|
||||
scanPackages.tag("packages", () -> Arrays.toString(basePackages))
|
||||
// perform the actual phase we're instrumenting
|
||||
|
||||
Reference in New Issue
Block a user