Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -289,15 +289,15 @@ public class BeanWrapperImpl extends AbstractNestablePropertyAccessor implements
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getValue() throws Exception {
|
||||
final Method readMethod = this.pd.getReadMethod();
|
||||
Method readMethod = this.pd.getReadMethod();
|
||||
if (System.getSecurityManager() != null) {
|
||||
AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
|
||||
ReflectionUtils.makeAccessible(readMethod);
|
||||
return null;
|
||||
});
|
||||
try {
|
||||
return AccessController.doPrivileged((PrivilegedExceptionAction<Object>) () ->
|
||||
readMethod.invoke(getWrappedInstance(), (Object[]) null), acc);
|
||||
return AccessController.doPrivileged((PrivilegedExceptionAction<Object>)
|
||||
() -> readMethod.invoke(getWrappedInstance(), (Object[]) null), acc);
|
||||
}
|
||||
catch (PrivilegedActionException pae) {
|
||||
throw pae.getException();
|
||||
@@ -310,8 +310,8 @@ public class BeanWrapperImpl extends AbstractNestablePropertyAccessor implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(final @Nullable Object value) throws Exception {
|
||||
final Method writeMethod = (this.pd instanceof GenericTypeAwarePropertyDescriptor ?
|
||||
public void setValue(@Nullable Object value) throws Exception {
|
||||
Method writeMethod = (this.pd instanceof GenericTypeAwarePropertyDescriptor ?
|
||||
((GenericTypeAwarePropertyDescriptor) this.pd).getWriteMethodForActualAccess() :
|
||||
this.pd.getWriteMethod());
|
||||
if (System.getSecurityManager() != null) {
|
||||
@@ -320,8 +320,8 @@ public class BeanWrapperImpl extends AbstractNestablePropertyAccessor implements
|
||||
return null;
|
||||
});
|
||||
try {
|
||||
AccessController.doPrivileged((PrivilegedExceptionAction<Object>) () ->
|
||||
writeMethod.invoke(getWrappedInstance(), value), acc);
|
||||
AccessController.doPrivileged((PrivilegedExceptionAction<Object>)
|
||||
() -> writeMethod.invoke(getWrappedInstance(), value), acc);
|
||||
}
|
||||
catch (PrivilegedActionException ex) {
|
||||
throw ex.getException();
|
||||
|
||||
@@ -356,21 +356,20 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
@Override
|
||||
public Object autowire(Class<?> beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
|
||||
// Use non-singleton bean definition, to avoid registering bean as dependent bean.
|
||||
final RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck);
|
||||
RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck);
|
||||
bd.setScope(SCOPE_PROTOTYPE);
|
||||
if (bd.getResolvedAutowireMode() == AUTOWIRE_CONSTRUCTOR) {
|
||||
return autowireConstructor(beanClass.getName(), bd, null, null).getWrappedInstance();
|
||||
}
|
||||
else {
|
||||
Object bean;
|
||||
final BeanFactory parent = this;
|
||||
if (System.getSecurityManager() != null) {
|
||||
bean = AccessController.doPrivileged((PrivilegedAction<Object>) () ->
|
||||
getInstantiationStrategy().instantiate(bd, null, parent),
|
||||
bean = AccessController.doPrivileged(
|
||||
(PrivilegedAction<Object>) () -> getInstantiationStrategy().instantiate(bd, null, this),
|
||||
getAccessControlContext());
|
||||
}
|
||||
else {
|
||||
bean = getInstantiationStrategy().instantiate(bd, null, parent);
|
||||
bean = getInstantiationStrategy().instantiate(bd, null, this);
|
||||
}
|
||||
populateBean(beanClass.getName(), bd, new BeanWrapperImpl(bean));
|
||||
return bean;
|
||||
@@ -545,7 +544,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
* @see #instantiateUsingFactoryMethod
|
||||
* @see #autowireConstructor
|
||||
*/
|
||||
protected Object doCreateBean(final String beanName, final RootBeanDefinition mbd, final @Nullable Object[] args)
|
||||
protected Object doCreateBean(String beanName, RootBeanDefinition mbd, @Nullable Object[] args)
|
||||
throws BeanCreationException {
|
||||
|
||||
// Instantiate the bean.
|
||||
@@ -556,7 +555,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
if (instanceWrapper == null) {
|
||||
instanceWrapper = createBeanInstance(beanName, mbd, args);
|
||||
}
|
||||
final Object bean = instanceWrapper.getWrappedInstance();
|
||||
Object bean = instanceWrapper.getWrappedInstance();
|
||||
Class<?> beanType = instanceWrapper.getWrappedClass();
|
||||
if (beanType != NullBean.class) {
|
||||
mbd.resolvedTargetType = beanType;
|
||||
@@ -1299,17 +1298,16 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
* @param mbd the bean definition for the bean
|
||||
* @return a BeanWrapper for the new instance
|
||||
*/
|
||||
protected BeanWrapper instantiateBean(final String beanName, final RootBeanDefinition mbd) {
|
||||
protected BeanWrapper instantiateBean(String beanName, RootBeanDefinition mbd) {
|
||||
try {
|
||||
Object beanInstance;
|
||||
final BeanFactory parent = this;
|
||||
if (System.getSecurityManager() != null) {
|
||||
beanInstance = AccessController.doPrivileged((PrivilegedAction<Object>) () ->
|
||||
getInstantiationStrategy().instantiate(mbd, beanName, parent),
|
||||
beanInstance = AccessController.doPrivileged(
|
||||
(PrivilegedAction<Object>) () -> getInstantiationStrategy().instantiate(mbd, beanName, this),
|
||||
getAccessControlContext());
|
||||
}
|
||||
else {
|
||||
beanInstance = getInstantiationStrategy().instantiate(mbd, beanName, parent);
|
||||
beanInstance = getInstantiationStrategy().instantiate(mbd, beanName, this);
|
||||
}
|
||||
BeanWrapper bw = new BeanWrapperImpl(beanInstance);
|
||||
initBeanWrapper(bw);
|
||||
@@ -1772,7 +1770,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
* @see #invokeInitMethods
|
||||
* @see #applyBeanPostProcessorsAfterInitialization
|
||||
*/
|
||||
protected Object initializeBean(final String beanName, final Object bean, @Nullable RootBeanDefinition mbd) {
|
||||
protected Object initializeBean(String beanName, Object bean, @Nullable RootBeanDefinition mbd) {
|
||||
if (System.getSecurityManager() != null) {
|
||||
AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
|
||||
invokeAwareMethods(beanName, bean);
|
||||
@@ -1803,7 +1801,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
return wrappedBean;
|
||||
}
|
||||
|
||||
private void invokeAwareMethods(final String beanName, final Object bean) {
|
||||
private void invokeAwareMethods(String beanName, Object bean) {
|
||||
if (bean instanceof Aware) {
|
||||
if (bean instanceof BeanNameAware) {
|
||||
((BeanNameAware) bean).setBeanName(beanName);
|
||||
@@ -1832,7 +1830,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
* @throws Throwable if thrown by init methods or by the invocation process
|
||||
* @see #invokeCustomInitMethod
|
||||
*/
|
||||
protected void invokeInitMethods(String beanName, final Object bean, @Nullable RootBeanDefinition mbd)
|
||||
protected void invokeInitMethods(String beanName, Object bean, @Nullable RootBeanDefinition mbd)
|
||||
throws Throwable {
|
||||
|
||||
boolean isInitializingBean = (bean instanceof InitializingBean);
|
||||
@@ -1873,7 +1871,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
* methods with arguments.
|
||||
* @see #invokeInitMethods
|
||||
*/
|
||||
protected void invokeCustomInitMethod(String beanName, final Object bean, RootBeanDefinition mbd)
|
||||
protected void invokeCustomInitMethod(String beanName, Object bean, RootBeanDefinition mbd)
|
||||
throws Throwable {
|
||||
|
||||
String initMethodName = mbd.getInitMethodName();
|
||||
@@ -1908,8 +1906,8 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
return null;
|
||||
});
|
||||
try {
|
||||
AccessController.doPrivileged((PrivilegedExceptionAction<Object>) () ->
|
||||
methodToInvoke.invoke(bean), getAccessControlContext());
|
||||
AccessController.doPrivileged((PrivilegedExceptionAction<Object>)
|
||||
() -> methodToInvoke.invoke(bean), getAccessControlContext());
|
||||
}
|
||||
catch (PrivilegedActionException pae) {
|
||||
InvocationTargetException ex = (InvocationTargetException) pae.getException();
|
||||
|
||||
@@ -239,10 +239,11 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
* @throws BeansException if the bean could not be created
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected <T> T doGetBean(final String name, @Nullable final Class<T> requiredType,
|
||||
@Nullable final Object[] args, boolean typeCheckOnly) throws BeansException {
|
||||
protected <T> T doGetBean(
|
||||
String name, @Nullable Class<T> requiredType, @Nullable Object[] args, boolean typeCheckOnly)
|
||||
throws BeansException {
|
||||
|
||||
final String beanName = transformedBeanName(name);
|
||||
String beanName = transformedBeanName(name);
|
||||
Object bean;
|
||||
|
||||
// Eagerly check singleton cache for manually registered singletons.
|
||||
@@ -294,7 +295,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
}
|
||||
|
||||
try {
|
||||
final RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName);
|
||||
RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName);
|
||||
checkMergedBeanDefinition(mbd, beanName, args);
|
||||
|
||||
// Guarantee initialization of beans that the current bean depends on.
|
||||
@@ -348,7 +349,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
|
||||
else {
|
||||
String scopeName = mbd.getScope();
|
||||
final Scope scope = this.scopes.get(scopeName);
|
||||
Scope scope = this.scopes.get(scopeName);
|
||||
if (scope == null) {
|
||||
throw new IllegalStateException("No Scope registered for scope name '" + scopeName + "'");
|
||||
}
|
||||
@@ -472,10 +473,12 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
return false;
|
||||
}
|
||||
if (isFactoryBean(beanName, mbd)) {
|
||||
final FactoryBean<?> fb = (FactoryBean<?>) getBean(FACTORY_BEAN_PREFIX + beanName);
|
||||
FactoryBean<?> fb = (FactoryBean<?>) getBean(FACTORY_BEAN_PREFIX + beanName);
|
||||
if (System.getSecurityManager() != null) {
|
||||
return AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
|
||||
((fb instanceof SmartFactoryBean && ((SmartFactoryBean<?>) fb).isPrototype()) || !fb.isSingleton()),
|
||||
return AccessController.doPrivileged(
|
||||
(PrivilegedAction<Boolean>) () ->
|
||||
((fb instanceof SmartFactoryBean && ((SmartFactoryBean<?>) fb).isPrototype()) ||
|
||||
!fb.isSingleton()),
|
||||
getAccessControlContext());
|
||||
}
|
||||
else {
|
||||
@@ -1457,7 +1460,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
* @throws CannotLoadBeanClassException if we failed to load the class
|
||||
*/
|
||||
@Nullable
|
||||
protected Class<?> resolveBeanClass(final RootBeanDefinition mbd, String beanName, final Class<?>... typesToMatch)
|
||||
protected Class<?> resolveBeanClass(RootBeanDefinition mbd, String beanName, Class<?>... typesToMatch)
|
||||
throws CannotLoadBeanClassException {
|
||||
|
||||
try {
|
||||
@@ -1465,8 +1468,8 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
return mbd.getBeanClass();
|
||||
}
|
||||
if (System.getSecurityManager() != null) {
|
||||
return AccessController.doPrivileged((PrivilegedExceptionAction<Class<?>>) () ->
|
||||
doResolveBeanClass(mbd, typesToMatch), getAccessControlContext());
|
||||
return AccessController.doPrivileged((PrivilegedExceptionAction<Class<?>>)
|
||||
() -> doResolveBeanClass(mbd, typesToMatch), getAccessControlContext());
|
||||
}
|
||||
else {
|
||||
return doResolveBeanClass(mbd, typesToMatch);
|
||||
@@ -1655,7 +1658,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
logger.trace(LogMessage.format("Bean creation exception on lazy FactoryBean type check: %s", ex));
|
||||
}
|
||||
else {
|
||||
logger.debug(LogMessage.format("Bean creation exception on non-lazy FactoryBean type check: %s", ex));
|
||||
logger.debug(LogMessage.format("Bean creation exception on eager FactoryBean type check: %s", ex));
|
||||
}
|
||||
onSuppressedException(ex);
|
||||
}
|
||||
|
||||
@@ -294,12 +294,12 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
* when deciding whether a bean definition should be considered as a
|
||||
* candidate for autowiring.
|
||||
*/
|
||||
public void setAutowireCandidateResolver(final AutowireCandidateResolver autowireCandidateResolver) {
|
||||
public void setAutowireCandidateResolver(AutowireCandidateResolver autowireCandidateResolver) {
|
||||
Assert.notNull(autowireCandidateResolver, "AutowireCandidateResolver must not be null");
|
||||
if (autowireCandidateResolver instanceof BeanFactoryAware) {
|
||||
if (System.getSecurityManager() != null) {
|
||||
AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
|
||||
((BeanFactoryAware) autowireCandidateResolver).setBeanFactory(DefaultListableBeanFactory.this);
|
||||
((BeanFactoryAware) autowireCandidateResolver).setBeanFactory(this);
|
||||
return null;
|
||||
}, getAccessControlContext());
|
||||
}
|
||||
@@ -512,8 +512,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
|
||||
// Check all bean definitions.
|
||||
for (String beanName : this.beanDefinitionNames) {
|
||||
// Only consider bean as eligible if the bean name
|
||||
// is not defined as alias for some other bean.
|
||||
// Only consider bean as eligible if the bean name is not defined as alias for some other bean.
|
||||
if (!isAlias(beanName)) {
|
||||
try {
|
||||
RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName);
|
||||
@@ -524,8 +523,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
boolean isFactoryBean = isFactoryBean(beanName, mbd);
|
||||
BeanDefinitionHolder dbd = mbd.getDecoratedDefinition();
|
||||
boolean matchFound = false;
|
||||
boolean allowFactoryBeanInit = allowEagerInit || containsSingleton(beanName);
|
||||
boolean isNonLazyDecorated = dbd != null && !mbd.isLazyInit();
|
||||
boolean allowFactoryBeanInit = (allowEagerInit || containsSingleton(beanName));
|
||||
boolean isNonLazyDecorated = (dbd != null && !mbd.isLazyInit());
|
||||
if (!isFactoryBean) {
|
||||
if (includeNonSingletons || isSingleton(beanName, mbd, dbd)) {
|
||||
matchFound = isTypeMatch(beanName, type, allowFactoryBeanInit);
|
||||
@@ -552,9 +551,9 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
throw ex;
|
||||
}
|
||||
// Probably a placeholder: let's ignore it for type matching purposes.
|
||||
LogMessage message = (ex instanceof CannotLoadBeanClassException) ?
|
||||
LogMessage message = (ex instanceof CannotLoadBeanClassException ?
|
||||
LogMessage.format("Ignoring bean class loading failure for bean '%s'", beanName) :
|
||||
LogMessage.format("Ignoring unresolvable metadata in bean definition '%s'", beanName);
|
||||
LogMessage.format("Ignoring unresolvable metadata in bean definition '%s'", beanName));
|
||||
logger.trace(message, ex);
|
||||
onSuppressedException(ex);
|
||||
}
|
||||
@@ -582,7 +581,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
}
|
||||
catch (NoSuchBeanDefinitionException ex) {
|
||||
// Shouldn't happen - probably a result of circular reference resolution...
|
||||
logger.trace(LogMessage.format("Failed to check manually registered singleton with name '%s'", beanName), ex);
|
||||
logger.trace(LogMessage.format(
|
||||
"Failed to check manually registered singleton with name '%s'", beanName), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -611,8 +611,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> Map<String, T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
|
||||
throws BeansException {
|
||||
public <T> Map<String, T> getBeansOfType(
|
||||
@Nullable Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException {
|
||||
|
||||
String[] beanNames = getBeanNamesForType(type, includeNonSingletons, allowEagerInit);
|
||||
Map<String, T> result = new LinkedHashMap<>(beanNames.length);
|
||||
@@ -753,12 +753,13 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
* @param resolver the AutowireCandidateResolver to use for the actual resolution algorithm
|
||||
* @return whether the bean should be considered as autowire candidate
|
||||
*/
|
||||
protected boolean isAutowireCandidate(String beanName, DependencyDescriptor descriptor, AutowireCandidateResolver resolver)
|
||||
protected boolean isAutowireCandidate(
|
||||
String beanName, DependencyDescriptor descriptor, AutowireCandidateResolver resolver)
|
||||
throws NoSuchBeanDefinitionException {
|
||||
|
||||
String beanDefinitionName = BeanFactoryUtils.transformedBeanName(beanName);
|
||||
if (containsBeanDefinition(beanDefinitionName)) {
|
||||
return isAutowireCandidate(beanName, getMergedLocalBeanDefinition(beanDefinitionName), descriptor, resolver);
|
||||
String bdName = BeanFactoryUtils.transformedBeanName(beanName);
|
||||
if (containsBeanDefinition(bdName)) {
|
||||
return isAutowireCandidate(beanName, getMergedLocalBeanDefinition(bdName), descriptor, resolver);
|
||||
}
|
||||
else if (containsSingleton(beanName)) {
|
||||
return isAutowireCandidate(beanName, new RootBeanDefinition(getType(beanName)), descriptor, resolver);
|
||||
@@ -790,15 +791,15 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
protected boolean isAutowireCandidate(String beanName, RootBeanDefinition mbd,
|
||||
DependencyDescriptor descriptor, AutowireCandidateResolver resolver) {
|
||||
|
||||
String beanDefinitionName = BeanFactoryUtils.transformedBeanName(beanName);
|
||||
resolveBeanClass(mbd, beanDefinitionName);
|
||||
String bdName = BeanFactoryUtils.transformedBeanName(beanName);
|
||||
resolveBeanClass(mbd, bdName);
|
||||
if (mbd.isFactoryMethodUnique && mbd.factoryMethodToIntrospect == null) {
|
||||
new ConstructorResolver(this).resolveFactoryMethodIfPossible(mbd);
|
||||
}
|
||||
BeanDefinitionHolder holder = (beanName.equals(beanDefinitionName) ?
|
||||
BeanDefinitionHolder holder = (beanName.equals(bdName) ?
|
||||
this.mergedBeanDefinitionHolders.computeIfAbsent(beanName,
|
||||
key -> new BeanDefinitionHolder(mbd, beanName, getAliases(beanDefinitionName))) :
|
||||
new BeanDefinitionHolder(mbd, beanName, getAliases(beanDefinitionName)));
|
||||
key -> new BeanDefinitionHolder(mbd, beanName, getAliases(bdName))) :
|
||||
new BeanDefinitionHolder(mbd, beanName, getAliases(bdName)));
|
||||
return resolver.isAutowireCandidate(holder, descriptor);
|
||||
}
|
||||
|
||||
@@ -873,11 +874,11 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
if (isFactoryBean(beanName)) {
|
||||
Object bean = getBean(FACTORY_BEAN_PREFIX + beanName);
|
||||
if (bean instanceof FactoryBean) {
|
||||
final FactoryBean<?> factory = (FactoryBean<?>) bean;
|
||||
FactoryBean<?> factory = (FactoryBean<?>) bean;
|
||||
boolean isEagerInit;
|
||||
if (System.getSecurityManager() != null && factory instanceof SmartFactoryBean) {
|
||||
isEagerInit = AccessController.doPrivileged((PrivilegedAction<Boolean>)
|
||||
((SmartFactoryBean<?>) factory)::isEagerInit,
|
||||
isEagerInit = AccessController.doPrivileged(
|
||||
(PrivilegedAction<Boolean>) ((SmartFactoryBean<?>) factory)::isEagerInit,
|
||||
getAccessControlContext());
|
||||
}
|
||||
else {
|
||||
@@ -899,7 +900,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
for (String beanName : beanNames) {
|
||||
Object singletonInstance = getSingleton(beanName);
|
||||
if (singletonInstance instanceof SmartInitializingSingleton) {
|
||||
final SmartInitializingSingleton smartSingleton = (SmartInitializingSingleton) singletonInstance;
|
||||
SmartInitializingSingleton smartSingleton = (SmartInitializingSingleton) singletonInstance;
|
||||
if (System.getSecurityManager() != null) {
|
||||
AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
|
||||
smartSingleton.afterSingletonsInstantiated();
|
||||
@@ -1324,7 +1325,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
private Object resolveMultipleBeans(DependencyDescriptor descriptor, @Nullable String beanName,
|
||||
@Nullable Set<String> autowiredBeanNames, @Nullable TypeConverter typeConverter) {
|
||||
|
||||
final Class<?> type = descriptor.getDependencyType();
|
||||
Class<?> type = descriptor.getDependencyType();
|
||||
|
||||
if (descriptor instanceof StreamDependencyDescriptor) {
|
||||
Map<String, Object> matchingBeans = findAutowireCandidates(beanName, type, descriptor);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -54,11 +54,11 @@ public abstract class FactoryBeanRegistrySupport extends DefaultSingletonBeanReg
|
||||
* or {@code null} if the type cannot be determined yet
|
||||
*/
|
||||
@Nullable
|
||||
protected Class<?> getTypeForFactoryBean(final FactoryBean<?> factoryBean) {
|
||||
protected Class<?> getTypeForFactoryBean(FactoryBean<?> factoryBean) {
|
||||
try {
|
||||
if (System.getSecurityManager() != null) {
|
||||
return AccessController.doPrivileged((PrivilegedAction<Class<?>>)
|
||||
factoryBean::getObjectType, getAccessControlContext());
|
||||
return AccessController.doPrivileged(
|
||||
(PrivilegedAction<Class<?>>) factoryBean::getObjectType, getAccessControlContext());
|
||||
}
|
||||
else {
|
||||
return factoryBean.getObjectType();
|
||||
@@ -153,9 +153,7 @@ public abstract class FactoryBeanRegistrySupport extends DefaultSingletonBeanReg
|
||||
* @throws BeanCreationException if FactoryBean object creation failed
|
||||
* @see org.springframework.beans.factory.FactoryBean#getObject()
|
||||
*/
|
||||
private Object doGetObjectFromFactoryBean(final FactoryBean<?> factory, final String beanName)
|
||||
throws BeanCreationException {
|
||||
|
||||
private Object doGetObjectFromFactoryBean(FactoryBean<?> factory, String beanName) throws BeanCreationException {
|
||||
Object object;
|
||||
try {
|
||||
if (System.getSecurityManager() != null) {
|
||||
|
||||
Reference in New Issue
Block a user