Browse Source

Polishing

Issue: SPR-11422
(cherry picked from commit 520ef9e)
pull/465/head
Juergen Hoeller 12 years ago
parent
commit
b40403cdc9
  1. 6
      spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java
  2. 17
      spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java

6
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -1373,7 +1373,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac @@ -1373,7 +1373,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
MutablePropertyValues mpvs = null;
List<PropertyValue> original;
if (System.getSecurityManager()!= null) {
if (System.getSecurityManager() != null) {
if (bw instanceof BeanWrapperImpl) {
((BeanWrapperImpl) bw).setSecurityContext(getAccessControlContext());
}
@ -1666,7 +1666,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac @@ -1666,7 +1666,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
/**
* Special DependencyDescriptor variant for autowire="byType".
* Special DependencyDescriptor variant for Spring's good old autowire="byType" mode.
* Always optional; never considering the parameter name for choosing a primary candidate.
*/
@SuppressWarnings("serial")

17
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -383,7 +383,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess @@ -383,7 +383,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
throw new IllegalStateException(
"Bean class name [" + beanClassObject + "] has not been resolved into an actual Class");
}
return (Class) beanClassObject;
return (Class<?>) beanClassObject;
}
public void setBeanClassName(String beanClassName) {
@ -393,7 +393,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess @@ -393,7 +393,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
public String getBeanClassName() {
Object beanClassObject = this.beanClass;
if (beanClassObject instanceof Class) {
return ((Class) beanClassObject).getName();
return ((Class<?>) beanClassObject).getName();
}
else {
return (String) beanClassObject;
@ -408,12 +408,12 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess @@ -408,12 +408,12 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
* @return the resolved bean class
* @throws ClassNotFoundException if the class name could be resolved
*/
public Class resolveBeanClass(ClassLoader classLoader) throws ClassNotFoundException {
public Class<?> resolveBeanClass(ClassLoader classLoader) throws ClassNotFoundException {
String className = getBeanClassName();
if (className == null) {
return null;
}
Class resolvedClass = ClassUtils.forName(className, classLoader);
Class<?> resolvedClass = ClassUtils.forName(className, classLoader);
this.beanClass = resolvedClass;
return resolvedClass;
}
@ -551,8 +551,8 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess @@ -551,8 +551,8 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
// Work out whether to apply setter autowiring or constructor autowiring.
// If it has a no-arg constructor it's deemed to be setter autowiring,
// otherwise we'll try constructor autowiring.
Constructor[] constructors = getBeanClass().getConstructors();
for (Constructor constructor : constructors) {
Constructor<?>[] constructors = getBeanClass().getConstructors();
for (Constructor<?> constructor : constructors) {
if (constructor.getParameterTypes().length == 0) {
return AUTOWIRE_BY_TYPE;
}
@ -678,6 +678,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess @@ -678,6 +678,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
/**
* Specify whether to allow access to non-public constructors and methods,
* for the case of externalized metadata pointing to those.
* The default is {@code true}; switch this to {@false} for public access only.
* <p>This applies to constructor resolution, factory method resolution,
* and also init/destroy methods. Bean property accessors have to be public
* in any case and are not affected by this setting.
@ -699,7 +700,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess @@ -699,7 +700,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
/**
* Specify whether to resolve constructors in lenient mode ({@code true},
* which is the default) or to switch to strict resolution (throwing an exception
* in case of ambigious constructors that all match when converting the arguments,
* in case of ambiguous constructors that all match when converting the arguments,
* whereas lenient mode would use the one with the 'closest' type matches).
*/
public void setLenientConstructorResolution(boolean lenientConstructorResolution) {

Loading…
Cancel
Save