Example usage for org.springframework.beans.factory BeanFactory isTypeMatch

List of usage examples for org.springframework.beans.factory BeanFactory isTypeMatch

Introduction

In this page you can find the example usage for org.springframework.beans.factory BeanFactory isTypeMatch.

Prototype

boolean isTypeMatch(String name, Class<?> typeToMatch) throws NoSuchBeanDefinitionException;

Source Link

Document

Check whether the bean with the given name matches the specified type.

Usage

From source file:org.hydracache.server.data.SpringConfigurationTest.java

@Test
public void expectedBeanTypes() {
    final BeanFactory factory = new ClassPathXmlApplicationContext(
            new String[] { "conflict-resolver-context.xml", "test-context.xml" });

    factory.isTypeMatch("versionFactory", VersionFactory.class);
    factory.isTypeMatch("versionMarshaller", BinaryMarshaller.class);
    factory.isTypeMatch("conflictResolver", ConflictResolver.class);
}

From source file:org.kuali.rice.test.CompositeBeanFactory.java

@Override
public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
    for (BeanFactory f : factories) {
        try {/*from w  w  w  . jav  a2  s.c om*/
            boolean b = f.isTypeMatch(name, targetType);
            if (b) {
                return b;
            }
        } catch (BeansException e) {
            LOG.info("bean exception", e);
        }
    }
    return false;
}