BeanFactory supports bean creation arguments for by-type lookup as well
Issue: SPR-11235
This commit is contained in:
@@ -974,6 +974,12 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
||||
return getBeanFactory().getBean(name, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getBean(Class<T> requiredType, Object... args) throws BeansException {
|
||||
assertBeanFactoryActive();
|
||||
return getBeanFactory().getBean(requiredType, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsBean(String name) {
|
||||
return getBeanFactory().containsBean(name);
|
||||
|
||||
@@ -134,11 +134,20 @@ public class SimpleJndiBeanFactory extends JndiLocatorSupport implements BeanFac
|
||||
public Object getBean(String name, Object... args) throws BeansException {
|
||||
if (args != null) {
|
||||
throw new UnsupportedOperationException(
|
||||
"SimpleJndiBeanFactory does not support explicit bean creation arguments)");
|
||||
"SimpleJndiBeanFactory does not support explicit bean creation arguments");
|
||||
}
|
||||
return getBean(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getBean(Class<T> requiredType, Object... args) throws BeansException {
|
||||
if (args != null) {
|
||||
throw new UnsupportedOperationException(
|
||||
"SimpleJndiBeanFactory does not support explicit bean creation arguments");
|
||||
}
|
||||
return getBean(requiredType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsBean(String name) {
|
||||
if (this.singletonObjects.containsKey(name) || this.resourceTypes.containsKey(name)) {
|
||||
|
||||
Reference in New Issue
Block a user