Example usage for org.springframework.beans.factory.config CustomScopeConfigurer CustomScopeConfigurer

List of usage examples for org.springframework.beans.factory.config CustomScopeConfigurer CustomScopeConfigurer

Introduction

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

Prototype

CustomScopeConfigurer

Source Link

Usage

From source file:com.orange.cepheus.cep.tenant.TenantConfiguration.java

/**
 * Declare the "tenant" scope.// w w  w. j  a v  a 2s  .  c o m
 */
@Bean
public static CustomScopeConfigurer customScopeConfigurer(TenantScope tenantScope) {
    CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    configurer.addScope("tenant", tenantScope);
    return configurer;
}

From source file:com.sunkur.springjavafxcontroller.config.AppContextConfig.java

@Bean
public CustomScopeConfigurer getCustomScopeConfigurer() {
    CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    final Map<String, Object> scopeMap = new HashMap<>();
    scopeMap.put("screen", screenScope());
    configurer.setScopes(scopeMap);/* w w  w  .j a  v  a2s . co m*/
    return configurer;
}

From source file:de.beyondjava.Main.java

/**
 * Allows the use of @Scope("view") on Spring @Component, @Service and @Controller
 * beans//from www .ja  v a2 s .c om
 */
@Bean
public static CustomScopeConfigurer scopeConfigurer() {
    CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    HashMap<String, Object> hashMap = new HashMap<String, Object>();
    hashMap.put("view", viewScope());
    configurer.setScopes(hashMap);
    return configurer;
}

From source file:guru.qas.martini.MartiniConfiguration.java

@Bean
@Lazy/*  w w w  .  j  a v a  2s . co  m*/
public static CustomScopeConfigurer customScopeConfigurer(ScenarioScope scope) {
    CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    configurer.addScope("scenario", scope);
    return configurer;
}

From source file:devbury.threadscope.ThreadScopeConfiguration.java

@Bean
public CustomScopeConfigurer threadCustomScopeConfigurer(ThreadScopeManager threadScopeManager,
        ConfigurableEnvironment environment) {
    CustomScopeConfigurer customScopeConfigurer = new CustomScopeConfigurer();
    // ConfigurationProperties not configured yet.  Use ConfigurableEnvironment to get properties.
    String scopeName = environment.getProperty(SCOPE_NAME_PROPERTY, ThreadScopeProperties.DEFAULT_SCOPE_NAME);
    logger.info("Thread scope name set to {}", scopeName);
    customScopeConfigurer.addScope(scopeName, threadScopeManager);
    return customScopeConfigurer;
}

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

@Bean
public CustomScopeConfigurer customScopeConfigurer() {
    final CustomScopeConfigurer customScopeConfigurer = new CustomScopeConfigurer();
    final Map<String, Object> hashMap = new HashMap<String, Object>();
    hashMap.put(ApplicationScope.NAME, new ApplicationScope());
    customScopeConfigurer.setScopes(hashMap);
    return customScopeConfigurer;
}

From source file:com.github.javarch.jsf.config.JavaServerFacesConfig.java

/**
 * /* ww  w.  j a  v a2  s .co  m*/
 * Registra escopos personalizveis para aplicao. Esta configurao possui
 * a equivalente em XML como:
 * 
 * <pre>
 * {@code
 *   <bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
 *       <property name="scopes">
 *           <map>
 *               <entry key="view">
 *                   <bean class="com.github.luksrn.webapp.core.spring.support.ViewScope"/>
 *               </entry>
 *               <entry key="thread">
 *                   <bean class="com.github.luksrn.webapp.core.spring.support.ThreadScope"/>
 *               </entry>
 *           </map>
 *       </property>
 *   </bean>
 *   }   
 * </pre>
 * 
 * 
 * @return
 */
@Bean
public CustomScopeConfigurer escoposPersonalizaveis() {
    CustomScopeConfigurer custom = new CustomScopeConfigurer();

    Map<String, Object> escopos = new HashMap<String, Object>();
    escopos.put("view", new ViewScope());
    custom.setScopes(escopos);

    return custom;
}

From source file:com.visural.domo.spring.TransactionImplTest.java

private AnnotationConfigApplicationContext springBootstrap(ConnectionSource source)
        throws BeansException, IllegalStateException {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.register(AnnotationAwareAspectJAutoProxyCreator.class);
    CustomScopeConfigurer conf = new CustomScopeConfigurer();
    Map<String, Object> scopes = new HashMap<String, Object>();
    TransactionScope scope = new TransactionScope();
    scopes.put(TransactionScope.Name, scope);
    conf.setScopes(scopes);//from   w  w  w. java 2s.  c om
    context.getBeanFactory().registerSingleton("transactionScope", scope);
    context.addBeanFactoryPostProcessor(conf);
    context.scan("com.visural");
    context.refresh();
    context.getBean(TransactionConfig.class).getConnectionProvider().registerDefaultConnectionSource(source);
    return context;
}

From source file:py.una.pol.karaku.test.configuration.BaseTestConfiguration.java

@Bean
public CustomScopeConfigurer configurer() {

    CustomScopeConfigurer toRet = new CustomScopeConfigurer();
    Map<String, Object> map = new HashMap<String, Object>();
    map.put(KarakuBaseConfiguration.SCOPE_CONVERSATION, new SimpleThreadScope());
    map.put(KarakuBaseConfiguration.SCOPE_CONVERSATION_MANUAL, new SimpleThreadScope());
    map.put(WebApplicationContext.SCOPE_SESSION, new SimpleThreadScope());
    toRet.setScopes(map);//  w  w w .j av a 2 s .c om
    return toRet;
}

From source file:ch.rasc.wampspring.config.DefaultWampConfiguration.java

@Bean
public static CustomScopeConfigurer webSocketScopeConfigurer(ConfigurableListableBeanFactory beanFactory) {

    beanFactory.registerResolvableDependency(WebSocketSession.class,
            new WampSessionScope.WebSocketSessionObjectFactory());
    beanFactory.registerResolvableDependency(WampSession.class,
            new WampSessionScope.WampSessionObjectFactory());

    CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    configurer.addScope("wampsession", new WampSessionScope());
    return configurer;
}