|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.beans.factory.generic.GenericBeanFactoryAccessor
public class GenericBeanFactoryAccessor
Simple wrapper around a ListableBeanFactory
that provides typed, generics-based
access to key methods. This removes the need for casting in many cases and should
increase compile-time type safety.
Provides a simple mechanism for accessing all beans with a particular Annotation
.
Constructor Summary | |
---|---|
GenericBeanFactoryAccessor(ListableBeanFactory beanFactory)
Constructs a GenericBeanFactoryAccessor that wraps the supplied ListableBeanFactory . |
Method Summary | ||
---|---|---|
|
getBean(String name)
|
|
|
getBean(String name,
Class<T> requiredType)
|
|
ListableBeanFactory |
getBeanFactory()
Return the wrapped ListableBeanFactory . |
|
|
getBeansOfType(Class<T> type)
|
|
|
getBeansOfType(Class<T> type,
boolean includeNonSingletons,
boolean allowEagerInit)
|
|
Map<String,Object> |
getBeansWithAnnotation(Class<? extends Annotation> annotationType)
Find all beans whose Class has the supplied Annotation type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericBeanFactoryAccessor(ListableBeanFactory beanFactory)
GenericBeanFactoryAccessor
that wraps the supplied ListableBeanFactory
.
Method Detail |
---|
public final ListableBeanFactory getBeanFactory()
ListableBeanFactory
.
public <T> T getBean(String name) throws BeansException
BeansException
BeanFactory.getBean(String)
public <T> T getBean(String name, Class<T> requiredType) throws BeansException
BeansException
BeanFactory.getBean(String, Class)
public <T> Map<String,T> getBeansOfType(Class<T> type) throws BeansException
BeansException
ListableBeanFactory.getBeansOfType(Class)
public <T> Map<String,T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException
BeansException
ListableBeanFactory.getBeansOfType(Class, boolean, boolean)
public Map<String,Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType)
Class
has the supplied Annotation
type.
annotationType
- the type of annotation to look for
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |