Polishing
This commit is contained in:
parent
9cf7b0e230
commit
b617e16d8d
|
@ -61,8 +61,7 @@ public abstract class AbstractBeanFactoryBasedTargetSourceCreator
|
|||
private ConfigurableBeanFactory beanFactory;
|
||||
|
||||
/** Internally used DefaultListableBeanFactory instances, keyed by bean name. */
|
||||
private final Map<String, DefaultListableBeanFactory> internalBeanFactories =
|
||||
new HashMap<>();
|
||||
private final Map<String, DefaultListableBeanFactory> internalBeanFactories = new HashMap<>();
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
@ -181,7 +181,7 @@ public class CommonsPool2TargetSource extends AbstractPoolingTargetSource implem
|
|||
}
|
||||
|
||||
/**
|
||||
* Set whether the call should bock when the pool is exhausted.
|
||||
* Set whether the call should block when the pool is exhausted.
|
||||
*/
|
||||
public void setBlockWhenExhausted(boolean blockWhenExhausted) {
|
||||
this.blockWhenExhausted = blockWhenExhausted;
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
package org.springframework.cache.aspectj;
|
||||
|
||||
/**
|
||||
* Utility to trick the compiler to throw a valid checked
|
||||
* exceptions within the interceptor.
|
||||
* Utility to trick the compiler to throw valid checked exceptions masked as
|
||||
* runtime exceptions within the interceptor.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
|
@ -36,4 +36,5 @@ final class AnyThrow {
|
|||
private static <E extends Throwable> void throwAny(Throwable e) throws E {
|
||||
throw (E) e;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
package org.springframework.beans.factory.groovy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import groovy.lang.GroovyObjectSupport;
|
||||
|
||||
|
@ -51,18 +51,8 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
|
|||
private static final String DESTROY_METHOD = "destroyMethod";
|
||||
private static final String SINGLETON = "singleton";
|
||||
|
||||
private static final List<String> dynamicProperties = new ArrayList<>(8);
|
||||
|
||||
static {
|
||||
dynamicProperties.add(PARENT);
|
||||
dynamicProperties.add(AUTOWIRE);
|
||||
dynamicProperties.add(CONSTRUCTOR_ARGS);
|
||||
dynamicProperties.add(FACTORY_BEAN);
|
||||
dynamicProperties.add(FACTORY_METHOD);
|
||||
dynamicProperties.add(INIT_METHOD);
|
||||
dynamicProperties.add(DESTROY_METHOD);
|
||||
dynamicProperties.add(SINGLETON);
|
||||
}
|
||||
private static final Set<String> dynamicProperties = Set.of(PARENT, AUTOWIRE, CONSTRUCTOR_ARGS,
|
||||
FACTORY_BEAN, FACTORY_METHOD, INIT_METHOD, DESTROY_METHOD, SINGLETON);
|
||||
|
||||
|
||||
private String beanName;
|
||||
|
@ -98,11 +88,11 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
|
|||
return this.beanName;
|
||||
}
|
||||
|
||||
public void setBeanDefinition(AbstractBeanDefinition definition) {
|
||||
void setBeanDefinition(AbstractBeanDefinition definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public AbstractBeanDefinition getBeanDefinition() {
|
||||
AbstractBeanDefinition getBeanDefinition() {
|
||||
if (this.definition == null) {
|
||||
this.definition = createBeanDefinition();
|
||||
}
|
||||
|
@ -126,19 +116,17 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
|
|||
return bd;
|
||||
}
|
||||
|
||||
public void setBeanDefinitionHolder(BeanDefinitionHolder holder) {
|
||||
void setBeanDefinitionHolder(BeanDefinitionHolder holder) {
|
||||
this.definition = (AbstractBeanDefinition) holder.getBeanDefinition();
|
||||
this.beanName = holder.getBeanName();
|
||||
}
|
||||
|
||||
public BeanDefinitionHolder getBeanDefinitionHolder() {
|
||||
BeanDefinitionHolder getBeanDefinitionHolder() {
|
||||
return new BeanDefinitionHolder(getBeanDefinition(), getBeanName());
|
||||
}
|
||||
|
||||
public void setParent(Object obj) {
|
||||
if (obj == null) {
|
||||
throw new IllegalArgumentException("Parent bean cannot be set to a null runtime bean reference!");
|
||||
}
|
||||
void setParent(Object obj) {
|
||||
Assert.notNull(obj, "Parent bean cannot be set to a null runtime bean reference.");
|
||||
if (obj instanceof String name) {
|
||||
this.parentName = name;
|
||||
}
|
||||
|
@ -152,7 +140,7 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
|
|||
getBeanDefinition().setAbstract(false);
|
||||
}
|
||||
|
||||
public GroovyBeanDefinitionWrapper addProperty(String propertyName, Object propertyValue) {
|
||||
GroovyBeanDefinitionWrapper addProperty(String propertyName, Object propertyValue) {
|
||||
if (propertyValue instanceof GroovyBeanDefinitionWrapper wrapper) {
|
||||
propertyValue = wrapper.getBeanDefinition();
|
||||
}
|
||||
|
|
|
@ -88,6 +88,7 @@ class GroovyDynamicElementReader extends GroovyObjectSupport {
|
|||
String myNamespace = this.rootNamespace;
|
||||
Map<String, String> myNamespaces = this.xmlNamespaces;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
Closure<Object> callable = new Closure<>(this) {
|
||||
@Override
|
||||
public Object call(Object... arguments) {
|
||||
|
|
|
@ -1732,7 +1732,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
|||
if (beanInstance != null) {
|
||||
Integer candidatePriority = getPriority(beanInstance);
|
||||
if (candidatePriority != null) {
|
||||
if (highestPriorityBeanName != null) {
|
||||
if (highestPriority != null) {
|
||||
if (candidatePriority.equals(highestPriority)) {
|
||||
throw new NoUniqueBeanDefinitionException(requiredType, candidates.size(),
|
||||
"Multiple beans found with the same priority ('" + highestPriority +
|
||||
|
|
|
@ -61,7 +61,7 @@ public class SimpleTimeZoneAwareLocaleContext extends SimpleLocaleContext implem
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " " + (this.timeZone != null ? this.timeZone.toString() : "-");
|
||||
return super.toString() + " " + (this.timeZone != null ? this.timeZone : "-");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class DeferredResult<T> {
|
|||
* Create a DeferredResult.
|
||||
*/
|
||||
public DeferredResult() {
|
||||
this(null, () -> RESULT_NONE);
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,8 +101,7 @@ public class DeferredResult<T> {
|
|||
* @param timeoutResult the result to use
|
||||
*/
|
||||
public DeferredResult(@Nullable Long timeoutValue, Object timeoutResult) {
|
||||
this.timeoutValue = timeoutValue;
|
||||
this.timeoutResult = () -> timeoutResult;
|
||||
this(timeoutValue, () -> timeoutResult);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -78,7 +78,7 @@ public interface DeferredResultProcessingInterceptor {
|
|||
* timeout result.
|
||||
* @param request the current request
|
||||
* @param deferredResult the DeferredResult for the current request
|
||||
* @param concurrentResult the result to which the {@code DeferredResult}
|
||||
* @param concurrentResult the concurrent result
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
default <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult,
|
||||
|
|
|
@ -57,7 +57,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
|
|||
|
||||
|
||||
private final List<ProduceMediaTypeExpression> mediaTypeAllList =
|
||||
Collections.singletonList(new ProduceMediaTypeExpression(MediaType.ALL_VALUE));
|
||||
List.of(new ProduceMediaTypeExpression(MediaType.ALL_VALUE));
|
||||
|
||||
private final List<ProduceMediaTypeExpression> expressions;
|
||||
|
||||
|
|
Loading…
Reference in New Issue