+ fixed exception unwrapping
+ optimized path for getBean (and thus fixed another test)
This commit is contained in:
@@ -21,7 +21,6 @@ import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.security.AccessControlContext;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.PrivilegedActionException;
|
||||
@@ -103,6 +102,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Juergen Hoeller
|
||||
* @author Rob Harrop
|
||||
* @author Mark Fisher
|
||||
* @author Costin Leau
|
||||
* @since 13.02.2004
|
||||
* @see RootBeanDefinition
|
||||
* @see DefaultListableBeanFactory
|
||||
@@ -1513,7 +1513,12 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
}
|
||||
}
|
||||
else {
|
||||
initMethod.invoke(bean, (Object[]) null);
|
||||
try {
|
||||
initMethod.invoke(bean, (Object[]) null);
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
throw ex.getTargetException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ import org.springframework.util.StringValueResolver;
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @author Costin Leau
|
||||
* @since 15 April 2001
|
||||
* @see #getBeanDefinition
|
||||
* @see #createBean
|
||||
@@ -207,12 +208,17 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
protected <T> T doGetBean(
|
||||
final String name, final Class<T> requiredType, final Object[] args, final boolean typeCheckOnly)
|
||||
throws BeansException {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<T>() {
|
||||
|
||||
public T run() {
|
||||
return doGetBeanRaw(name, requiredType, args, typeCheckOnly);
|
||||
}
|
||||
});
|
||||
if (System.getSecurityManager() != null) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<T>() {
|
||||
public T run() {
|
||||
return doGetBeanRaw(name, requiredType, args, typeCheckOnly);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
return doGetBeanRaw(name, requiredType, args, typeCheckOnly);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return an instance, which may be shared or independent, of the specified bean.
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Member;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.security.AccessControlContext;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.ArrayList;
|
||||
@@ -63,6 +62,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
* @author Juergen Hoeller
|
||||
* @author Rob Harrop
|
||||
* @author Mark Fisher
|
||||
* @author Costin Leau
|
||||
* @since 2.0
|
||||
* @see #autowireConstructor
|
||||
* @see #instantiateUsingFactoryMethod
|
||||
|
||||
@@ -81,6 +81,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
* @author Costin Leau
|
||||
* @since 16 April 2001
|
||||
* @see StaticListableBeanFactory
|
||||
* @see PropertiesBeanDefinitionReader
|
||||
|
||||
@@ -46,6 +46,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
* </ul>
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Costin Leau
|
||||
* @since 2.0
|
||||
* @see AbstractBeanFactory
|
||||
* @see org.springframework.beans.factory.DisposableBean
|
||||
|
||||
Reference in New Issue
Block a user