org.szegedi.spring.beans.factory
Class BeanFactoryUtilsEx

java.lang.Object
  extended by org.szegedi.spring.beans.factory.BeanFactoryUtilsEx

public class BeanFactoryUtilsEx
extends java.lang.Object

An extension to the beans factory utils in Spring.

Version:
$Id: BeanFactoryUtilsEx.java 79 2007-09-17 11:24:06Z szegedia $
Author:
Attila Szegedi

Constructor Summary
BeanFactoryUtilsEx()
           
 
Method Summary
static java.lang.Object beanOfTypeIncludingAncestors(org.springframework.beans.factory.ListableBeanFactory lbf, java.lang.Class type)
          Returns a bean of specified type in the specified bean factory or its ancestors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanFactoryUtilsEx

public BeanFactoryUtilsEx()
Method Detail

beanOfTypeIncludingAncestors

public static java.lang.Object beanOfTypeIncludingAncestors(org.springframework.beans.factory.ListableBeanFactory lbf,
                                                            java.lang.Class type)
Returns a bean of specified type in the specified bean factory or its ancestors. In contrast with Spring's BeanFactoryUtils, doesn't throw an exception if no bean is found, but rather returns null.

Parameters:
lbf - the bean factory to look for the bean
type - the expected type of the bean
Returns:
the bean - if exactly one is defined. null - if none is defined
Throws:
org.springframework.beans.factory.NoSuchBeanDefinitionException - if more than one bean is defined