mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
added first cut of getBean(Class) lookup method
This commit is contained in:
+4
@@ -892,6 +892,10 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
||||
return getBeanFactory().getBean(name, requiredType);
|
||||
}
|
||||
|
||||
public <T> T getBean(Class<T> requiredType) throws BeansException {
|
||||
return getBeanFactory().getBean(requiredType);
|
||||
}
|
||||
|
||||
public Object getBean(String name, Object... args) throws BeansException {
|
||||
return getBeanFactory().getBean(name, args);
|
||||
}
|
||||
|
||||
+4
@@ -118,6 +118,10 @@ public class SimpleJndiBeanFactory extends JndiLocatorSupport implements BeanFac
|
||||
}
|
||||
}
|
||||
|
||||
public <T> T getBean(Class<T> requiredType) throws BeansException {
|
||||
return getBean(requiredType.getSimpleName(), requiredType);
|
||||
}
|
||||
|
||||
public Object getBean(String name, Object... args) throws BeansException {
|
||||
if (args != null) {
|
||||
throw new UnsupportedOperationException(
|
||||
|
||||
Reference in New Issue
Block a user