commit
cb4fa3795a
|
|
@ -60,7 +60,7 @@ public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionExcepti
|
||||||
public NoUniqueBeanDefinitionException(Class<?> type, Collection<String> beanNamesFound) {
|
public NoUniqueBeanDefinitionException(Class<?> type, Collection<String> beanNamesFound) {
|
||||||
super(type, "expected single matching bean but found " + beanNamesFound.size() + ": " +
|
super(type, "expected single matching bean but found " + beanNamesFound.size() + ": " +
|
||||||
StringUtils.collectionToCommaDelimitedString(beanNamesFound));
|
StringUtils.collectionToCommaDelimitedString(beanNamesFound));
|
||||||
this.numberOfBeansFound = beanNamesFound.size();
|
this.numberOfBeansFound = beanNamesFound.size();
|
||||||
this.beanNamesFound = beanNamesFound;
|
this.beanNamesFound = beanNamesFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@ public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionExcepti
|
||||||
public NoUniqueBeanDefinitionException(ResolvableType type, Collection<String> beanNamesFound) {
|
public NoUniqueBeanDefinitionException(ResolvableType type, Collection<String> beanNamesFound) {
|
||||||
super(type, "expected single matching bean but found " + beanNamesFound.size() + ": " +
|
super(type, "expected single matching bean but found " + beanNamesFound.size() + ": " +
|
||||||
StringUtils.collectionToCommaDelimitedString(beanNamesFound));
|
StringUtils.collectionToCommaDelimitedString(beanNamesFound));
|
||||||
this.numberOfBeansFound = beanNamesFound.size();
|
this.numberOfBeansFound = beanNamesFound.size();
|
||||||
this.beanNamesFound = beanNamesFound;
|
this.beanNamesFound = beanNamesFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -707,7 +707,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||||
ReflectionUtils.makeAccessible(method);
|
ReflectionUtils.makeAccessible(method);
|
||||||
method.invoke(bean, arguments);
|
method.invoke(bean, arguments);
|
||||||
}
|
}
|
||||||
catch (InvocationTargetException ex){
|
catch (InvocationTargetException ex) {
|
||||||
throw ex.getTargetException();
|
throw ex.getTargetException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
|
@ -59,7 +59,7 @@ public class BeanExpressionContext {
|
||||||
if (this.beanFactory.containsBean(key)) {
|
if (this.beanFactory.containsBean(key)) {
|
||||||
return this.beanFactory.getBean(key);
|
return this.beanFactory.getBean(key);
|
||||||
}
|
}
|
||||||
else if (this.scope != null){
|
else if (this.scope != null) {
|
||||||
return this.scope.resolveContextualObject(key);
|
return this.scope.resolveContextualObject(key);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
|
@ -121,7 +121,7 @@ public class PreferencesPlaceholderConfigurer extends PropertyPlaceholderConfigu
|
||||||
@Nullable
|
@Nullable
|
||||||
protected String resolvePlaceholder(@Nullable String path, String key, Preferences preferences) {
|
protected String resolvePlaceholder(@Nullable String path, String key, Preferences preferences) {
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
// Do not create the node if it does not exist...
|
// Do not create the node if it does not exist...
|
||||||
try {
|
try {
|
||||||
if (preferences.nodeExists(path)) {
|
if (preferences.nodeExists(path)) {
|
||||||
return preferences.node(path).get(key, null);
|
return preferences.node(path).get(key, null);
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ public class PropertyOverrideConfigurer extends PropertyResourceConfigurer {
|
||||||
"': expected 'beanName" + this.beanNameSeparator + "property'");
|
"': expected 'beanName" + this.beanNameSeparator + "property'");
|
||||||
}
|
}
|
||||||
String beanName = key.substring(0, separatorIndex);
|
String beanName = key.substring(0, separatorIndex);
|
||||||
String beanProperty = key.substring(separatorIndex+1);
|
String beanProperty = key.substring(separatorIndex + 1);
|
||||||
this.beanNames.add(beanName);
|
this.beanNames.add(beanName);
|
||||||
applyPropertyValue(factory, beanName, beanProperty, value);
|
applyPropertyValue(factory, beanName, beanProperty, value);
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
|
|
|
||||||
|
|
@ -1122,7 +1122,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
return obtainFromSupplier(instanceSupplier, beanName);
|
return obtainFromSupplier(instanceSupplier, beanName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mbd.getFactoryMethodName() != null) {
|
if (mbd.getFactoryMethodName() != null) {
|
||||||
return instantiateUsingFactoryMethod(beanName, mbd, args);
|
return instantiateUsingFactoryMethod(beanName, mbd, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1149,7 +1149,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
// Candidate constructors for autowiring?
|
// Candidate constructors for autowiring?
|
||||||
Constructor<?>[] ctors = determineConstructorsFromBeanPostProcessors(beanClass, beanName);
|
Constructor<?>[] ctors = determineConstructorsFromBeanPostProcessors(beanClass, beanName);
|
||||||
if (ctors != null || mbd.getResolvedAutowireMode() == AUTOWIRE_CONSTRUCTOR ||
|
if (ctors != null || mbd.getResolvedAutowireMode() == AUTOWIRE_CONSTRUCTOR ||
|
||||||
mbd.hasConstructorArgumentValues() || !ObjectUtils.isEmpty(args)) {
|
mbd.hasConstructorArgumentValues() || !ObjectUtils.isEmpty(args)) {
|
||||||
return autowireConstructor(beanName, mbd, ctors, args);
|
return autowireConstructor(beanName, mbd, ctors, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -661,7 +661,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType)
|
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType)
|
||||||
throws NoSuchBeanDefinitionException{
|
throws NoSuchBeanDefinitionException {
|
||||||
|
|
||||||
A ann = null;
|
A ann = null;
|
||||||
Class<?> beanType = getType(beanName);
|
Class<?> beanType = getType(beanName);
|
||||||
|
|
|
||||||
|
|
@ -510,7 +510,7 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
|
||||||
* Reads the value of the entry. Correctly interprets bean references for
|
* Reads the value of the entry. Correctly interprets bean references for
|
||||||
* values that are prefixed with an asterisk.
|
* values that are prefixed with an asterisk.
|
||||||
*/
|
*/
|
||||||
private Object readValue(Map.Entry<? ,?> entry) {
|
private Object readValue(Map.Entry<?, ?> entry) {
|
||||||
Object val = entry.getValue();
|
Object val = entry.getValue();
|
||||||
if (val instanceof String) {
|
if (val instanceof String) {
|
||||||
String strVal = (String) val;
|
String strVal = (String) val;
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ public class SimpleInstantiationStrategy implements InstantiationStrategy {
|
||||||
(PrivilegedExceptionAction<Constructor<?>>) clazz::getDeclaredConstructor);
|
(PrivilegedExceptionAction<Constructor<?>>) clazz::getDeclaredConstructor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
constructorToUse = clazz.getDeclaredConstructor();
|
constructorToUse = clazz.getDeclaredConstructor();
|
||||||
}
|
}
|
||||||
bd.resolvedConstructorOrFactoryMethod = constructorToUse;
|
bd.resolvedConstructorOrFactoryMethod = constructorToUse;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -432,7 +432,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType)
|
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType)
|
||||||
throws NoSuchBeanDefinitionException{
|
throws NoSuchBeanDefinitionException {
|
||||||
|
|
||||||
Class<?> beanType = getType(beanName);
|
Class<?> beanType = getType(beanName);
|
||||||
return (beanType != null ? AnnotationUtils.findAnnotation(beanType, annotationType) : null);
|
return (beanType != null ? AnnotationUtils.findAnnotation(beanType, annotationType) : null);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
|
@ -118,7 +118,7 @@ public class SimpleConstructorNamespaceHandler implements NamespaceHandler {
|
||||||
"Constructor argument '" + argName + "' specifies a negative index", attr);
|
"Constructor argument '" + argName + "' specifies a negative index", attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cvs.hasIndexedArgumentValue(index)){
|
if (cvs.hasIndexedArgumentValue(index)) {
|
||||||
parserContext.getReaderContext().error(
|
parserContext.getReaderContext().error(
|
||||||
"Constructor argument '" + argName + "' with index "+ index+" already defined using <constructor-arg>." +
|
"Constructor argument '" + argName + "' with index "+ index+" already defined using <constructor-arg>." +
|
||||||
" Only one approach may be used per argument.", attr);
|
" Only one approach may be used per argument.", attr);
|
||||||
|
|
@ -130,7 +130,7 @@ public class SimpleConstructorNamespaceHandler implements NamespaceHandler {
|
||||||
// no escaping -> ctr name
|
// no escaping -> ctr name
|
||||||
else {
|
else {
|
||||||
String name = Conventions.attributeNameToPropertyName(argName);
|
String name = Conventions.attributeNameToPropertyName(argName);
|
||||||
if (containsArgWithName(name, cvs)){
|
if (containsArgWithName(name, cvs)) {
|
||||||
parserContext.getReaderContext().error(
|
parserContext.getReaderContext().error(
|
||||||
"Constructor argument '" + argName + "' already defined using <constructor-arg>." +
|
"Constructor argument '" + argName + "' already defined using <constructor-arg>." +
|
||||||
" Only one approach may be used per argument.", attr);
|
" Only one approach may be used per argument.", attr);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2018 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.lang.Nullable;
|
||||||
public interface AttributeAccessor {
|
public interface AttributeAccessor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the attribute defined by {@code name} to the supplied {@code value}.
|
* Set the attribute defined by {@code name} to the supplied {@code value}.
|
||||||
* If {@code value} is {@code null}, the attribute is {@link #removeAttribute removed}.
|
* If {@code value} is {@code null}, the attribute is {@link #removeAttribute removed}.
|
||||||
* <p>In general, users should take care to prevent overlaps with other
|
* <p>In general, users should take care to prevent overlaps with other
|
||||||
* metadata attributes by using fully-qualified names, perhaps using
|
* metadata attributes by using fully-qualified names, perhaps using
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
|
@ -251,7 +251,7 @@ public abstract class ObjectUtils {
|
||||||
* @param obj the object to append
|
* @param obj the object to append
|
||||||
* @return the new array (of the same component type; never {@code null})
|
* @return the new array (of the same component type; never {@code null})
|
||||||
*/
|
*/
|
||||||
public static <A, O extends A> A[] addObjectToArray(@Nullable A[] array, @Nullable O obj) {
|
public static <A, O extends A> A[] addObjectToArray(@Nullable A[] array, @Nullable O obj) {
|
||||||
Class<?> compType = Object.class;
|
Class<?> compType = Object.class;
|
||||||
if (array != null) {
|
if (array != null) {
|
||||||
compType = array.getClass().getComponentType();
|
compType = array.getClass().getComponentType();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
|
@ -38,7 +38,7 @@ abstract class UpdateMessageDigestInputStream extends InputStream {
|
||||||
*/
|
*/
|
||||||
public void updateMessageDigest(MessageDigest messageDigest) throws IOException {
|
public void updateMessageDigest(MessageDigest messageDigest) throws IOException {
|
||||||
int data;
|
int data;
|
||||||
while ((data = read()) != -1){
|
while ((data = read()) != -1) {
|
||||||
messageDigest.update((byte) data);
|
messageDigest.update((byte) data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +54,7 @@ abstract class UpdateMessageDigestInputStream extends InputStream {
|
||||||
public void updateMessageDigest(MessageDigest messageDigest, int len) throws IOException {
|
public void updateMessageDigest(MessageDigest messageDigest, int len) throws IOException {
|
||||||
int data;
|
int data;
|
||||||
int bytesRead = 0;
|
int bytesRead = 0;
|
||||||
while (bytesRead < len && (data = read()) != -1){
|
while (bytesRead < len && (data = read()) != -1) {
|
||||||
messageDigest.update((byte) data);
|
messageDigest.update((byte) data);
|
||||||
bytesRead++;
|
bytesRead++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue