Example usage for org.springframework.beans.factory.config ConfigurableListableBeanFactory registerScope

List of usage examples for org.springframework.beans.factory.config ConfigurableListableBeanFactory registerScope

Introduction

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

Prototype

void registerScope(String scopeName, Scope scope);

Source Link

Document

Register the given scope, backed by the given Scope implementation.

Usage

From source file:com.github.persapiens.jsfboot.annotations.JsfCdiToSpringBeanFactoryPostProcessor.java

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory clbf) throws BeansException {
    clbf.registerScope("view", new ViewScope());
}

From source file:org.wte4j.examples.showcase.server.config.WebContextTestExecutionListener.java

@Override
public void prepareTestInstance(TestContext testContext) {
    if (testContext.getApplicationContext() instanceof GenericApplicationContext) {
        GenericApplicationContext context = (GenericApplicationContext) testContext.getApplicationContext();
        ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
        beanFactory.registerScope(WebApplicationContext.SCOPE_REQUEST, new SimpleThreadScope());
        beanFactory.registerScope(WebApplicationContext.SCOPE_SESSION, new SimpleThreadScope());
    }//  w ww  . j  a v  a  2  s. c  om
}

From source file:org.codehaus.groovy.grails.webflow.scope.ScopeRegistrar.java

@SuppressWarnings("deprecation")
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    beanFactory.registerScope(ScopeType.FLASH.name().toLowerCase(), new FlashScope());
    beanFactory.registerScope(ScopeType.VIEW.name().toLowerCase(), new ViewScope());
    beanFactory.registerScope(ScopeType.FLOW.name().toLowerCase(), new FlowScope());
    beanFactory.registerScope(ScopeType.CONVERSATION.name().toLowerCase(), new ConversationScope());
}

From source file:org.jboss.spring.cluster.CachePostProcessor.java

public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    beanFactory.registerScope(scopeName, new CacheScope(pojoCache));
}

From source file:org.joinfaces.annotations.JsfCdiToSpringBeanFactoryPostProcessor.java

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory clbf) throws BeansException {
    clbf.registerScope("view", new ViewScope());

    for (String beanName : clbf.getBeanDefinitionNames()) {
        BeanDefinition definition = clbf.getBeanDefinition(beanName);
        registerJsfCdiToSpring(definition);
    }// w  w  w  . j a va  2s .c o m
}

From source file:dhbw.ka.mwi.businesshorizon2.tests.ui.assets.TestExecutionListener.java

@Override
public void prepareTestInstance(TestContext testContext) throws Exception {

    if (testContext.getApplicationContext() instanceof GenericApplicationContext) {
        GenericApplicationContext context = (GenericApplicationContext) testContext.getApplicationContext();
        ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
        Scope requestScope = new SimpleThreadScope();
        beanFactory.registerScope("request", requestScope);
        Scope sessionScope = new SimpleThreadScope();
        beanFactory.registerScope("session", sessionScope);
    }/*  w w w  .ja  v a 2s .c  o  m*/
}

From source file:org.vaadin.spring.internal.UIScope.java

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    logger.debug("Registering UI scope with beanFactory [{}]", beanFactory);
    beanFactory.registerScope(UI_SCOPE_NAME, this);
}

From source file:com.vaadin.spring.internal.ViewScopeImpl.java

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    this.beanFactory = beanFactory;
    LOGGER.debug("Registering Vaadin View scope with bean factory [{}]", beanFactory);
    beanFactory.registerScope(VAADIN_VIEW_SCOPE_NAME, this);
}

From source file:org.activiti.spring.components.scope.ProcessScope.java

public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {

    beanFactory.registerScope(ProcessScope.PROCESS_SCOPE_NAME, this);

    Assert.isInstanceOf(BeanDefinitionRegistry.class, beanFactory,
            "BeanFactory was not a BeanDefinitionRegistry, so ProcessScope cannot be used.");

    BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;

    for (String beanName : beanFactory.getBeanDefinitionNames()) {
        BeanDefinition definition = beanFactory.getBeanDefinition(beanName);
        // Replace this or any of its inner beans with scoped proxy if it has this scope
        boolean scoped = PROCESS_SCOPE_NAME.equals(definition.getScope());
        Scopifier scopifier = new Scopifier(registry, PROCESS_SCOPE_NAME, proxyTargetClass, scoped);
        scopifier.visitBeanDefinition(definition);
        if (scoped) {
            Scopifier.createScopedProxy(beanName, definition, registry, proxyTargetClass);
        }/*  ww  w.j a va  2s  .  c om*/
    }

    beanFactory.registerSingleton(ProcessScope.PROCESS_SCOPE_PROCESS_VARIABLES_SINGLETON,
            this.processVariablesMap);
    beanFactory.registerResolvableDependency(ProcessInstance.class, createSharedProcessInstance());
}

From source file:com.vaadin.spring.internal.VaadinSessionScope.java

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory)
        throws BeansException {
    LOGGER.debug("Registering VaadinSession scope with bean factory [{}]", configurableListableBeanFactory);
    configurableListableBeanFactory.registerScope(VAADIN_SESSION_SCOPE_NAME, this);
}