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

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

Introduction

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

Prototype

boolean isPrototype(String name) throws NoSuchBeanDefinitionException;

Source Link

Document

Is this bean a prototype?

Usage

From source file:org.shredzone.commons.taglib.proxy.AbstractTagProxy.java

/**
 * Creates a new instance of the implementing target bean.
 *
 * @param jspContext/*from   w  w w .  j av a 2s  . c o m*/
 *            {@link JspContext}
 */
@SuppressWarnings("unchecked")
protected void initTargetBean(JspContext jspContext) {
    BeanFactory bf = getBeanFactory(jspContext);

    String beanName = getBeanName();
    if (!bf.isPrototype(beanName)) {
        throw new IllegalStateException("Bean " + beanName + " must be prototype scoped!");
    }

    tagImpl = (T) bf.getBean(beanName);
}

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

@Override
public boolean isPrototype(String name) throws NoSuchBeanDefinitionException {
    for (BeanFactory f : factories) {
        try {/*from   w  ww  .j av a 2s  .c o  m*/
            boolean b = f.isPrototype(name);
            if (b) {
                return b;
            }
        } catch (BeansException e) {
            LOG.info("bean exception", e);
        }
    }
    return false;
}