Example usage for org.springframework.beans.factory.config BeanDefinition SCOPE_PROTOTYPE

List of usage examples for org.springframework.beans.factory.config BeanDefinition SCOPE_PROTOTYPE

Introduction

In this page you can find the example usage for org.springframework.beans.factory.config BeanDefinition SCOPE_PROTOTYPE.

Prototype

String SCOPE_PROTOTYPE

To view the source code for org.springframework.beans.factory.config BeanDefinition SCOPE_PROTOTYPE.

Click Source Link

Document

Scope identifier for the standard prototype scope: "prototype".

Usage

From source file:io.github.moosbusch.lumpi.beans.impl.LumPiMiscBean.java

@Bean
@Lazy/*from  w  ww .  j av  a  2s .  c om*/
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public DefaultPromptAction<? extends BindableWindow, ? extends AbstractSubmitablePrompt<?>> createDefaultPromptAction() {
    return new DefaultPromptAction<>();
}

From source file:cf.spring.servicebroker.ServiceBrokerConfiguration.java

@Bean
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
Catalog serviceBrokerCatalog() {
    return catalogProvider().getCatalogAccessor().createCatalog();
}

From source file:com.freebox.engeneering.application.system.configuration.ViewServiceContext.java

@Bean
@State(APPLICATION)
@Placeholder(FOOTER)
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public FooterController footerView() {
    return new FooterController();
}

From source file:io.github.moosbusch.lumpi.beans.impl.LumPiMiscBean.java

@Bean
@Lazy
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public FillScrollPane createFillScrollPane() {
    return new FillScrollPane();
}

From source file:gov.nih.nci.cacis.xds.client.TestXDSConfigImpl.java

/**
 * Dummy DocumentAccessManager until ESD-3073 lands, after that, has to be removed
 * @return DocumentAccessManager//from  w  w w .j av  a 2 s  . c  o m
 */
@Bean
@Scope(value = BeanDefinition.SCOPE_PROTOTYPE)
public DocumentAccessManager dummyDocumentAccessManager() {
    return new DocumentAccessManager() {

        @Override
        public void revokeDocumentAccess(String arg0, String arg1) throws AuthzProvisioningException {
            //do nothing - this is dummy impl                
        }

        @Override
        public void grantDocumentAccess(String arg0, String arg1) throws AuthzProvisioningException {
            //do nothing - this is dummy impl
        }

        @Override
        public boolean checkDocumentAccess(String arg0, String arg1) throws AuthzProvisioningException {
            // always give access - this is dummy impl
            return true;
        }
    };
}

From source file:io.github.moosbusch.lumpi.beans.impl.LumPiMiscBean.java

@Bean
@Lazy
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public DefaultSubmitableFileBrowserSheet createDefaultSubmitableFileBrowserSheet() {
    return new DefaultSubmitableFileBrowserSheet();
}

From source file:com.freebox.engeneering.application.system.configuration.ViewServiceContext.java

@Bean
@State(FREEBOX_LOGIN)//from  www.  j  a  v  a  2 s . co m
@Placeholder(CONTENT)
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public FreeboxLoginController freeboxLoginController() {
    return new FreeboxLoginController();
}

From source file:com.github.steveash.spring.WiringFactoryBeanFactoryPostProcessor.java

private void addPrototypeDef(ConfigurableListableBeanFactory beanFactory, String beanDefName,
        Class<?> protoBeanClass) {
    String beanName = getPrototypeBeanNameFromBeanClass(protoBeanClass);
    if (beanFactory.containsBeanDefinition(beanName)) {
        throw new BeanDefinitionValidationException("Trying to register a bean definition for a synthetic "
                + "prototype bean with name " + beanName + " due to the bean factory of name " + beanDefName
                + " but a bean with this name already exists!");
    }//from  w  ww  . jav a  2  s.  c  om

    GenericBeanDefinition protoBean = new GenericBeanDefinition();
    protoBean.setLazyInit(true);
    protoBean.setBeanClass(protoBeanClass);
    protoBean.setScope(BeanDefinition.SCOPE_PROTOTYPE);
    protoBean.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_CONSTRUCTOR);
    protoBean.setBeanClassName(protoBeanClass.getName());

    log.debug("Dynamically adding prototype bean {} from factory {}", beanName, beanDefName);
    BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;
    registry.registerBeanDefinition(beanName, protoBean);
}

From source file:org.jdal.vaadin.beans.DefaultsBeanDefinitionParser.java

/**
 * @return/* ww w.j  a  v  a 2s. com*/
 */
private ComponentDefinition registerPaginatorView(Element element, ParserContext parserContext) {
    BeanDefinitionBuilder bdb = BeanDefinitionBuilder.genericBeanDefinition(VaadinPaginator.class);
    bdb.addPropertyValue("pageSizes", "10,20,30,40,50,100,All");
    bdb.setScope(BeanDefinition.SCOPE_PROTOTYPE);
    BeanComponentDefinition bcd = new BeanComponentDefinition(bdb.getBeanDefinition(),
            PAGINATOR_VIEW_BEAN_NAME);
    registerBeanComponentDefinition(element, parserContext, bcd);
    return bcd;
}

From source file:br.com.caelum.vraptor.ioc.spring.SpringRegistry.java

/**
 * From org.springframework.context.annotation.ClassPathBeanDefinitionScanner#applyScope()
 * @param definition/*from  w w  w .  j  ava2  s.  c  o m*/
 * @param scopeMetadata
 *
 * @return
 */
private BeanDefinitionHolder applyScopeOn(BeanDefinitionHolder definition, ScopeMetadata scopeMetadata) {
    String scope = scopeMetadata.getScopeName();
    ScopedProxyMode proxyMode = scopeMetadata.getScopedProxyMode();
    definition.getBeanDefinition().setScope(scope);
    if (BeanDefinition.SCOPE_SINGLETON.equals(scope) || BeanDefinition.SCOPE_PROTOTYPE.equals(scope)
            || proxyMode.equals(ScopedProxyMode.NO)) {
        return definition;
    } else {
        boolean proxyTargetClass = proxyMode.equals(ScopedProxyMode.TARGET_CLASS);
        return ScopedProxyUtils.createScopedProxy(definition, (BeanDefinitionRegistry) beanFactory,
                proxyTargetClass);
    }
}