prevent non-public access to bean class as well, if demanded

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1654 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller
2009-07-29 15:15:47 +00:00
parent 92ce56028a
commit 7d40e1d032
@@ -841,6 +841,11 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
// Make sure bean class is actually resolved at this point.
Class beanClass = resolveBeanClass(mbd, beanName);
if (beanClass != null && !Modifier.isPublic(beanClass.getModifiers()) && !mbd.isNonPublicAccessAllowed()) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
"Bean class isn't public, and non-public access not allowed: " + beanClass.getName());
}
if (mbd.getFactoryMethodName() != null) {
return instantiateUsingFactoryMethod(beanName, mbd, args);
}