Consistent use of Class<?> in core container method signatures
(cherry picked from commit 1461744
)
This commit is contained in:
parent
ef363b0f7a
commit
13ca2752ae
|
@ -185,7 +185,7 @@ public interface AutowireCapableBeanFactory extends BeanFactory {
|
||||||
* @see #AUTOWIRE_BY_TYPE
|
* @see #AUTOWIRE_BY_TYPE
|
||||||
* @see #AUTOWIRE_CONSTRUCTOR
|
* @see #AUTOWIRE_CONSTRUCTOR
|
||||||
*/
|
*/
|
||||||
Object createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;
|
Object createBean(Class<?> beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate a new bean instance of the given class with the specified autowire
|
* Instantiate a new bean instance of the given class with the specified autowire
|
||||||
|
@ -213,7 +213,7 @@ public interface AutowireCapableBeanFactory extends BeanFactory {
|
||||||
* @see #applyBeanPostProcessorsBeforeInitialization
|
* @see #applyBeanPostProcessorsBeforeInitialization
|
||||||
* @see #applyBeanPostProcessorsAfterInitialization
|
* @see #applyBeanPostProcessorsAfterInitialization
|
||||||
*/
|
*/
|
||||||
Object autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;
|
Object autowire(Class<?> beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autowire the bean properties of the given bean instance by name or type.
|
* Autowire the bean properties of the given bean instance by name or type.
|
||||||
|
|
|
@ -243,7 +243,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
* Ignore the given dependency type for autowiring:
|
* Ignore the given dependency type for autowiring:
|
||||||
* for example, String. Default is none.
|
* for example, String. Default is none.
|
||||||
*/
|
*/
|
||||||
public void ignoreDependencyType(Class type) {
|
public void ignoreDependencyType(Class<?> type) {
|
||||||
this.ignoredDependencyTypes.add(type);
|
this.ignoredDependencyTypes.add(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
* @see org.springframework.beans.factory.BeanFactoryAware
|
* @see org.springframework.beans.factory.BeanFactoryAware
|
||||||
* @see org.springframework.context.ApplicationContextAware
|
* @see org.springframework.context.ApplicationContextAware
|
||||||
*/
|
*/
|
||||||
public void ignoreDependencyInterface(Class ifc) {
|
public void ignoreDependencyInterface(Class<?> ifc) {
|
||||||
this.ignoredDependencyInterfaces.add(ifc);
|
this.ignoredDependencyInterfaces.add(ifc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,14 +329,14 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
// Specialized methods for fine-grained control over the bean lifecycle
|
// Specialized methods for fine-grained control over the bean lifecycle
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
public Object createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
|
public Object createBean(Class<?> beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
|
||||||
// Use non-singleton bean definition, to avoid registering bean as dependent bean.
|
// Use non-singleton bean definition, to avoid registering bean as dependent bean.
|
||||||
RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck);
|
RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck);
|
||||||
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
|
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
|
||||||
return createBean(beanClass.getName(), bd, null);
|
return createBean(beanClass.getName(), bd, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
|
public Object autowire(Class<?> beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
|
||||||
// Use non-singleton bean definition, to avoid registering bean as dependent bean.
|
// Use non-singleton bean definition, to avoid registering bean as dependent bean.
|
||||||
final RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck);
|
final RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck);
|
||||||
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
|
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
|
||||||
|
@ -349,7 +349,6 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
|
|
||||||
if (System.getSecurityManager() != null) {
|
if (System.getSecurityManager() != null) {
|
||||||
bean = AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
bean = AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||||
|
|
||||||
public Object run() {
|
public Object run() {
|
||||||
return getInstantiationStrategy().instantiate(bd, null, parent);
|
return getInstantiationStrategy().instantiate(bd, null, parent);
|
||||||
}
|
}
|
||||||
|
@ -490,7 +489,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
instanceWrapper = createBeanInstance(beanName, mbd, args);
|
instanceWrapper = createBeanInstance(beanName, mbd, args);
|
||||||
}
|
}
|
||||||
final Object bean = (instanceWrapper != null ? instanceWrapper.getWrappedInstance() : null);
|
final Object bean = (instanceWrapper != null ? instanceWrapper.getWrappedInstance() : null);
|
||||||
Class beanType = (instanceWrapper != null ? instanceWrapper.getWrappedClass() : null);
|
Class<?> beanType = (instanceWrapper != null ? instanceWrapper.getWrappedClass() : null);
|
||||||
|
|
||||||
// Allow post-processors to modify the merged bean definition.
|
// Allow post-processors to modify the merged bean definition.
|
||||||
synchronized (mbd.postProcessingLock) {
|
synchronized (mbd.postProcessingLock) {
|
||||||
|
@ -587,7 +586,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
for (BeanPostProcessor bp : getBeanPostProcessors()) {
|
for (BeanPostProcessor bp : getBeanPostProcessors()) {
|
||||||
if (bp instanceof SmartInstantiationAwareBeanPostProcessor) {
|
if (bp instanceof SmartInstantiationAwareBeanPostProcessor) {
|
||||||
SmartInstantiationAwareBeanPostProcessor ibp = (SmartInstantiationAwareBeanPostProcessor) bp;
|
SmartInstantiationAwareBeanPostProcessor ibp = (SmartInstantiationAwareBeanPostProcessor) bp;
|
||||||
Class predicted = ibp.predictBeanType(targetType, beanName);
|
Class<?> predicted = ibp.predictBeanType(targetType, beanName);
|
||||||
if (predicted != null && (typesToMatch.length != 1 || !FactoryBean.class.equals(typesToMatch[0]) ||
|
if (predicted != null && (typesToMatch.length != 1 || !FactoryBean.class.equals(typesToMatch[0]) ||
|
||||||
FactoryBean.class.isAssignableFrom(predicted))) {
|
FactoryBean.class.isAssignableFrom(predicted))) {
|
||||||
return predicted;
|
return predicted;
|
||||||
|
@ -836,7 +835,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
* @throws BeansException if any post-processing failed
|
* @throws BeansException if any post-processing failed
|
||||||
* @see MergedBeanDefinitionPostProcessor#postProcessMergedBeanDefinition
|
* @see MergedBeanDefinitionPostProcessor#postProcessMergedBeanDefinition
|
||||||
*/
|
*/
|
||||||
protected void applyMergedBeanDefinitionPostProcessors(RootBeanDefinition mbd, Class beanType, String beanName)
|
protected void applyMergedBeanDefinitionPostProcessors(RootBeanDefinition mbd, Class<?> beanType, String beanName)
|
||||||
throws BeansException {
|
throws BeansException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -887,7 +886,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
* @throws BeansException if any post-processing failed
|
* @throws BeansException if any post-processing failed
|
||||||
* @see InstantiationAwareBeanPostProcessor#postProcessBeforeInstantiation
|
* @see InstantiationAwareBeanPostProcessor#postProcessBeforeInstantiation
|
||||||
*/
|
*/
|
||||||
protected Object applyBeanPostProcessorsBeforeInstantiation(Class beanClass, String beanName)
|
protected Object applyBeanPostProcessorsBeforeInstantiation(Class<?> beanClass, String beanName)
|
||||||
throws BeansException {
|
throws BeansException {
|
||||||
|
|
||||||
for (BeanPostProcessor bp : getBeanPostProcessors()) {
|
for (BeanPostProcessor bp : getBeanPostProcessors()) {
|
||||||
|
@ -916,7 +915,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
*/
|
*/
|
||||||
protected BeanWrapper createBeanInstance(String beanName, RootBeanDefinition mbd, Object[] args) {
|
protected BeanWrapper createBeanInstance(String beanName, RootBeanDefinition mbd, Object[] args) {
|
||||||
// Make sure bean class is actually resolved at this point.
|
// Make sure bean class is actually resolved at this point.
|
||||||
Class beanClass = resolveBeanClass(mbd, beanName);
|
Class<?> beanClass = resolveBeanClass(mbd, beanName);
|
||||||
|
|
||||||
if (beanClass != null && !Modifier.isPublic(beanClass.getModifiers()) && !mbd.isNonPublicAccessAllowed()) {
|
if (beanClass != null && !Modifier.isPublic(beanClass.getModifiers()) && !mbd.isNonPublicAccessAllowed()) {
|
||||||
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
|
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
|
||||||
|
@ -968,7 +967,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
* @throws org.springframework.beans.BeansException in case of errors
|
* @throws org.springframework.beans.BeansException in case of errors
|
||||||
* @see org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor#determineCandidateConstructors
|
* @see org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor#determineCandidateConstructors
|
||||||
*/
|
*/
|
||||||
protected Constructor[] determineConstructorsFromBeanPostProcessors(Class beanClass, String beanName)
|
protected Constructor[] determineConstructorsFromBeanPostProcessors(Class<?> beanClass, String beanName)
|
||||||
throws BeansException {
|
throws BeansException {
|
||||||
|
|
||||||
if (beanClass != null && hasInstantiationAwareBeanPostProcessors()) {
|
if (beanClass != null && hasInstantiationAwareBeanPostProcessors()) {
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
||||||
* Create a new RootBeanDefinition for a singleton.
|
* Create a new RootBeanDefinition for a singleton.
|
||||||
* @param beanClass the class of the bean to instantiate
|
* @param beanClass the class of the bean to instantiate
|
||||||
*/
|
*/
|
||||||
public RootBeanDefinition(Class beanClass) {
|
public RootBeanDefinition(Class<?> beanClass) {
|
||||||
super();
|
super();
|
||||||
setBeanClass(beanClass);
|
setBeanClass(beanClass);
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
||||||
* @param dependencyCheck whether to perform a dependency check for objects
|
* @param dependencyCheck whether to perform a dependency check for objects
|
||||||
* (not applicable to autowiring a constructor, thus ignored there)
|
* (not applicable to autowiring a constructor, thus ignored there)
|
||||||
*/
|
*/
|
||||||
public RootBeanDefinition(Class beanClass, int autowireMode, boolean dependencyCheck) {
|
public RootBeanDefinition(Class<?> beanClass, int autowireMode, boolean dependencyCheck) {
|
||||||
super();
|
super();
|
||||||
setBeanClass(beanClass);
|
setBeanClass(beanClass);
|
||||||
setAutowireMode(autowireMode);
|
setAutowireMode(autowireMode);
|
||||||
|
@ -191,7 +191,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
||||||
* @param cargs the constructor argument values to apply
|
* @param cargs the constructor argument values to apply
|
||||||
* @param pvs the property values to apply
|
* @param pvs the property values to apply
|
||||||
*/
|
*/
|
||||||
public RootBeanDefinition(Class beanClass, ConstructorArgumentValues cargs, MutablePropertyValues pvs) {
|
public RootBeanDefinition(Class<?> beanClass, ConstructorArgumentValues cargs, MutablePropertyValues pvs) {
|
||||||
super(cargs, pvs);
|
super(cargs, pvs);
|
||||||
setBeanClass(beanClass);
|
setBeanClass(beanClass);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue