Java 类org.springframework.beans.factory.config.CustomScopeConfigurer 实例源码

项目:app-ms    文件:SpringConfiguration.java   
@Bean
public static CustomScopeConfigurer customScopeConfigurer(final ContainerRequestScope scope) {

    final CustomScopeConfigurer configurer = new CustomScopeConfigurer();

    configurer.setScopes(Collections.singletonMap("request", scope));
    return configurer;
}
项目:martini-core    文件:MartiniConfiguration.java   
@Bean
@Lazy
public static CustomScopeConfigurer customScopeConfigurer(
    ScenarioScope scope
) {
    CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    configurer.addScope("scenario", scope);
    return configurer;
}
项目:jaf-examples    文件:ScopeNamespaceHandler.java   
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
    RootBeanDefinition beanDefinition = new RootBeanDefinition();
    beanDefinition.setBeanClass(CustomScopeConfigurer.class);
    beanDefinition.setScope("singleton");

    Map<String, Object> scopes = new HashMap<>();
    scopes.put("thread", new SimpleThreadScope());
    beanDefinition.getPropertyValues().add("scopes", scopes);

    parserContext.getRegistry().registerBeanDefinition("CustomScopeConfigurer", beanDefinition);
    return beanDefinition;
}
项目:Voting_2b    文件:Application.java   
@Bean
public static CustomScopeConfigurer customScopeConfigurer(){
    CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    Map<String, Object> scopes = new HashMap<String, Object>();
    scopes.put("view", new ViewScope());
    configurer.setScopes(scopes);
    return configurer;
}
项目:spring-boot-starter-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;
}
项目:sitemonitoring-production    文件:SpringConfiguration.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
@Bean
public CustomScopeConfigurer viewScopeConfigurer() {
    CustomScopeConfigurer customScopeConfigurer = new CustomScopeConfigurer();
    Map scopes = new HashMap();
    scopes.put("view", new ViewScope());
    customScopeConfigurer.setScopes(scopes);
    return customScopeConfigurer;
}
项目:dolphin-platform    文件:DolphinPlatformSpringTestBootstrap.java   
@Bean(name = "customScopeConfigurer")
public static CustomScopeConfigurer createClientScope(final ClientSession clientSession) {
    Assert.requireNonNull(clientSession, "clientSession");
    CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    configurer.addScope(ClientScopeImpl.CLIENT_SCOPE, new TestClientScope(clientSession));
    return configurer;
}
项目:fiware-cepheus    文件:TenantConfiguration.java   
/**
 * Declare the "tenant" scope.
 */
@Bean
public static CustomScopeConfigurer customScopeConfigurer (TenantScope tenantScope) {
    CustomScopeConfigurer configurer = new CustomScopeConfigurer ();
    configurer.addScope("tenant", tenantScope);
    return configurer;
}
项目:JSF-on-Spring-Boot    文件:Main.java   
@SuppressWarnings("serial")
@Bean public org.springframework.beans.factory.config.CustomScopeConfigurer customScopeConfigurer(){
    CustomScopeConfigurer csc = new CustomScopeConfigurer();
    csc.setScopes(new HashMap<String, Object>() {{
        put("view", new com.liferay.faces.demos.spring.ViewScope());
    }});
    return csc;
   }
项目:wampspring    文件: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;
}
项目:karaku    文件: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);
    return toRet;
}
项目:matsuo-core    文件:ScopeConfig.java   
@Bean
public static CustomScopeConfigurer registerScopes() {
  CustomScopeConfigurer customScopeConfigurer = new CustomScopeConfigurer();
  Map<String, Object> scopes = new HashMap<>();
  scopes.put("wideSession", new WideSessionScope());
  customScopeConfigurer.setScopes(scopes);
  return customScopeConfigurer;
}
项目:jsf-exmple    文件:PersistenceConfig.java   
@Bean
// must be static
// http://stackoverflow.com/questions/14942304/springs-javaconfig-and-customscopeconfigurer-issue
public static CustomScopeConfigurer customScope() {
    CustomScopeConfigurer cus = new CustomScopeConfigurer();
    cus.addScope("view", new ViewScope());
    return cus;
}
项目:arsnova-backend    文件:TestAppConfig.java   
@Bean
public CustomScopeConfigurer customScopeConfigurer() {
    final CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    configurer.addScope("session", new SimpleThreadScope());

    return configurer;
}
项目:spring4-sandbox    文件:AppConfig.java   
@Bean
public static CustomScopeConfigurer customScopeConfigurer() {
    Map<String, Object> scopes = new HashMap<>();
    scopes.put("view", new ViewScope());

    CustomScopeConfigurer bean = new CustomScopeConfigurer();
    bean.setScopes(scopes);

    return bean;
}
项目:spring-autowire-qualified-beans    文件:AutowireTest3.java   
@Bean
static CustomScopeConfigurer customScopes() {
    final CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    final Map<String, Object> scopes = new HashMap<String, Object>();
    scopes.put("foobarScope", new SimpleThreadScope());
    configurer.setScopes(scopes);
    return configurer;
}
项目:spring-autowire-qualified-beans    文件:AutowireTest1.java   
@Bean
static CustomScopeConfigurer customScopes() {
  final CustomScopeConfigurer configurer = new CustomScopeConfigurer();
  final Map<String, Object> scopes = new HashMap<String, Object>();
  scopes.put("foobarScope", new SimpleThreadScope());
  configurer.setScopes(scopes);
  return configurer;
}
项目:spring-autowire-qualified-beans    文件:AutowireTest2.java   
@Bean
static CustomScopeConfigurer customScopes() {
  final CustomScopeConfigurer configurer = new CustomScopeConfigurer();
  final Map<String, Object> scopes = new HashMap<String, Object>();
  scopes.put("foobarScope", new SimpleThreadScope());
  configurer.setScopes(scopes);
  return configurer;
}
项目:spring-struts-testcase    文件:TestXmlWebApplicationContext.java   
@Override
protected void onRefresh() {
    super.onRefresh();
    Map beansOfType = getBeansOfType(CustomScopeConfigurer.class);
    if (!beansOfType.isEmpty()) {
        return;
    }
    addCustomScopeConfigurerBean();
}
项目:spring-struts-testcase    文件:TestXmlWebApplicationContext.java   
private void addCustomScopeConfigurerBean() {
    AutowireCapableBeanFactory autowireCapableBeanFactory = getAutowireCapableBeanFactory();
    CustomScopeConfigurer customScopeConfigurer = (CustomScopeConfigurer) autowireCapableBeanFactory.createBean(CustomScopeConfigurer.class);
    HashMap map = new HashMap();
    map.put(RequestManager.SESSION, SessionScope.class);
    map.put(RequestManager.REQUEST, RequestScope.class);
    customScopeConfigurer.setScopes(map);
    autowireCapableBeanFactory.initializeBean(customScopeConfigurer, SCOPE_CONFIGURER);
}
项目:factcast    文件:SpringConfig.java   
@Bean
CustomScopeConfigurer getCustomScopeConfigurer() {
    CustomScopeConfigurer cf = new CustomScopeConfigurer();
    cf.addScope("request", new org.springframework.web.context.request.RequestScope());
    return cf;
}
项目:spring4-understanding    文件:WebSocketMessageBrokerConfigurationSupport.java   
@Bean
public static CustomScopeConfigurer webSocketScopeConfigurer() {
    CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    configurer.addScope("websocket", new SimpSessionScope());
    return configurer;
}
项目:spring4-understanding    文件:MessageBrokerBeanDefinitionParser.java   
@Override
public BeanDefinition parse(Element element, ParserContext context) {

    Object source = context.extractSource(element);
    CompositeComponentDefinition compDefinition = new CompositeComponentDefinition(element.getTagName(), source);
    context.pushContainingComponent(compDefinition);

    Element channelElem = DomUtils.getChildElementByTagName(element, "client-inbound-channel");
    RuntimeBeanReference inChannel = getMessageChannel("clientInboundChannel", channelElem, context, source);

    channelElem = DomUtils.getChildElementByTagName(element, "client-outbound-channel");
    RuntimeBeanReference outChannel = getMessageChannel("clientOutboundChannel", channelElem, context, source);

    channelElem = DomUtils.getChildElementByTagName(element, "broker-channel");
    RuntimeBeanReference brokerChannel = getMessageChannel("brokerChannel", channelElem, context, source);

    RuntimeBeanReference userRegistry = registerUserRegistry(element, context, source);
    Object userDestHandler = registerUserDestHandler(element, userRegistry, inChannel, brokerChannel, context, source);

    RuntimeBeanReference converter = registerMessageConverter(element, context, source);
    RuntimeBeanReference template = registerMessagingTemplate(element, brokerChannel, converter, context, source);
    registerAnnotationMethodMessageHandler(element, inChannel, outChannel,converter, template, context, source);

    RootBeanDefinition broker = registerMessageBroker(element, inChannel, outChannel, brokerChannel,
            userDestHandler, template, userRegistry, context, source);

    // WebSocket and sub-protocol handling

    ManagedMap<String, Object> urlMap = registerHandlerMapping(element, context, source);
    RuntimeBeanReference stompHandler = registerStompHandler(element, inChannel, outChannel, context, source);
    for (Element endpointElem : DomUtils.getChildElementsByTagName(element, "stomp-endpoint")) {
        RuntimeBeanReference requestHandler = registerRequestHandler(endpointElem, stompHandler, context, source);
        String pathAttribute = endpointElem.getAttribute("path");
        Assert.state(StringUtils.hasText(pathAttribute), "Invalid <stomp-endpoint> (no path mapping)");
        List<String> paths = Arrays.asList(StringUtils.tokenizeToStringArray(pathAttribute, ","));
        for (String path : paths) {
            path = path.trim();
            Assert.state(StringUtils.hasText(path), "Invalid <stomp-endpoint> path attribute: " + pathAttribute);
            if (DomUtils.getChildElementByTagName(endpointElem, "sockjs") != null) {
                path = path.endsWith("/") ? path + "**" : path + "/**";
            }
            urlMap.put(path, requestHandler);
        }
    }

    Map<String, Object> scopeMap = Collections.<String, Object>singletonMap("websocket", new SimpSessionScope());
    RootBeanDefinition scopeConfigurer = new RootBeanDefinition(CustomScopeConfigurer.class);
    scopeConfigurer.getPropertyValues().add("scopes", scopeMap);
    registerBeanDefByName("webSocketScopeConfigurer", scopeConfigurer, context, source);

    registerWebSocketMessageBrokerStats(broker, inChannel, outChannel, context, source);

    context.popAndRegisterContainingComponent();
    return null;
}
项目:joinfaces    文件:ViewScopeAutoConfiguration.java   
@Bean
public static CustomScopeConfigurer viewScopeConfigurer() {
    CustomScopeConfigurer customScopeConfigurer = new CustomScopeConfigurer();
    customScopeConfigurer.addScope(ViewScope.SCOPE_VIEW, new ViewScope());
    return customScopeConfigurer;
}
项目:multitenancy    文件:MultitenancyConfig.java   
@Bean
public static CustomScopeConfigurer configureTenantScope() {
    CustomScopeConfigurer customScopeConfigurer = new CustomScopeConfigurer();
    customScopeConfigurer.addScope(TenantScope.SCOPE_NAME, new TenantScope());
    return customScopeConfigurer;
}
项目:dolphin-platform    文件:SpringBeanFactory.java   
@Bean(name = "customScopeConfigurer")
public static CustomScopeConfigurer createClientScope() {
    final CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    configurer.addScope(ClientScopeImpl.CLIENT_SCOPE, new ClientScopeImpl());
    return configurer;
}
项目:HAIBA-EPIMIBA-classification    文件:EPIMIBAConfiguration.java   
@Bean
public static CustomScopeConfigurer scopeConfigurer() {
    return new SimpleThreadScopeConfigurer();
}