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

SpringConfiguration.java 文件源码 项目:app-ms 阅读 29 收藏 0 点赞 0 评论 0
@Bean
public static CustomScopeConfigurer customScopeConfigurer(final ContainerRequestScope scope) {

    final CustomScopeConfigurer configurer = new CustomScopeConfigurer();

    configurer.setScopes(Collections.singletonMap("request", scope));
    return configurer;
}
MartiniConfiguration.java 文件源码 项目:martini-core 阅读 22 收藏 0 点赞 0 评论 0
@Bean
@Lazy
public static CustomScopeConfigurer customScopeConfigurer(
    ScenarioScope scope
) {
    CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    configurer.addScope("scenario", scope);
    return configurer;
}
ScopeNamespaceHandler.java 文件源码 项目:jaf-examples 阅读 24 收藏 0 点赞 0 评论 0
@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;
}
Application.java 文件源码 项目:Voting_2b 阅读 20 收藏 0 点赞 0 评论 0
@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;
}
ThreadScopeConfiguration.java 文件源码 项目:spring-boot-starter-threadscope 阅读 24 收藏 0 点赞 0 评论 0
@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;
}
SpringConfiguration.java 文件源码 项目:sitemonitoring-production 阅读 20 收藏 0 点赞 0 评论 0
@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;
}
DolphinPlatformSpringTestBootstrap.java 文件源码 项目:dolphin-platform 阅读 19 收藏 0 点赞 0 评论 0
@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;
}
TenantConfiguration.java 文件源码 项目:fiware-cepheus 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Declare the "tenant" scope.
 */
@Bean
public static CustomScopeConfigurer customScopeConfigurer (TenantScope tenantScope) {
    CustomScopeConfigurer configurer = new CustomScopeConfigurer ();
    configurer.addScope("tenant", tenantScope);
    return configurer;
}
Main.java 文件源码 项目:JSF-on-Spring-Boot 阅读 20 收藏 0 点赞 0 评论 0
@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;
   }
DefaultWampConfiguration.java 文件源码 项目:wampspring 阅读 19 收藏 0 点赞 0 评论 0
@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;
}
BaseTestConfiguration.java 文件源码 项目:karaku 阅读 22 收藏 0 点赞 0 评论 0
@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;
}
ScopeConfig.java 文件源码 项目:matsuo-core 阅读 21 收藏 0 点赞 0 评论 0
@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;
}
PersistenceConfig.java 文件源码 项目:jsf-exmple 阅读 23 收藏 0 点赞 0 评论 0
@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;
}
TestAppConfig.java 文件源码 项目:arsnova-backend 阅读 19 收藏 0 点赞 0 评论 0
@Bean
public CustomScopeConfigurer customScopeConfigurer() {
    final CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    configurer.addScope("session", new SimpleThreadScope());

    return configurer;
}
AppConfig.java 文件源码 项目:spring4-sandbox 阅读 23 收藏 0 点赞 0 评论 0
@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;
}
AutowireTest3.java 文件源码 项目:spring-autowire-qualified-beans 阅读 21 收藏 0 点赞 0 评论 0
@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;
}
AutowireTest1.java 文件源码 项目:spring-autowire-qualified-beans 阅读 19 收藏 0 点赞 0 评论 0
@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;
}
AutowireTest2.java 文件源码 项目:spring-autowire-qualified-beans 阅读 20 收藏 0 点赞 0 评论 0
@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;
}
TestXmlWebApplicationContext.java 文件源码 项目:spring-struts-testcase 阅读 23 收藏 0 点赞 0 评论 0
@Override
protected void onRefresh() {
    super.onRefresh();
    Map beansOfType = getBeansOfType(CustomScopeConfigurer.class);
    if (!beansOfType.isEmpty()) {
        return;
    }
    addCustomScopeConfigurerBean();
}
TestXmlWebApplicationContext.java 文件源码 项目:spring-struts-testcase 阅读 22 收藏 0 点赞 0 评论 0
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);
}
SpringConfig.java 文件源码 项目:factcast 阅读 21 收藏 0 点赞 0 评论 0
@Bean
CustomScopeConfigurer getCustomScopeConfigurer() {
    CustomScopeConfigurer cf = new CustomScopeConfigurer();
    cf.addScope("request", new org.springframework.web.context.request.RequestScope());
    return cf;
}
WebSocketMessageBrokerConfigurationSupport.java 文件源码 项目:spring4-understanding 阅读 152 收藏 0 点赞 0 评论 0
@Bean
public static CustomScopeConfigurer webSocketScopeConfigurer() {
    CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    configurer.addScope("websocket", new SimpSessionScope());
    return configurer;
}
MessageBrokerBeanDefinitionParser.java 文件源码 项目:spring4-understanding 阅读 26 收藏 0 点赞 0 评论 0
@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;
}
ViewScopeAutoConfiguration.java 文件源码 项目:joinfaces 阅读 22 收藏 0 点赞 0 评论 0
@Bean
public static CustomScopeConfigurer viewScopeConfigurer() {
    CustomScopeConfigurer customScopeConfigurer = new CustomScopeConfigurer();
    customScopeConfigurer.addScope(ViewScope.SCOPE_VIEW, new ViewScope());
    return customScopeConfigurer;
}
MultitenancyConfig.java 文件源码 项目:multitenancy 阅读 21 收藏 0 点赞 0 评论 0
@Bean
public static CustomScopeConfigurer configureTenantScope() {
    CustomScopeConfigurer customScopeConfigurer = new CustomScopeConfigurer();
    customScopeConfigurer.addScope(TenantScope.SCOPE_NAME, new TenantScope());
    return customScopeConfigurer;
}
SpringBeanFactory.java 文件源码 项目:dolphin-platform 阅读 21 收藏 0 点赞 0 评论 0
@Bean(name = "customScopeConfigurer")
public static CustomScopeConfigurer createClientScope() {
    final CustomScopeConfigurer configurer = new CustomScopeConfigurer();
    configurer.addScope(ClientScopeImpl.CLIENT_SCOPE, new ClientScopeImpl());
    return configurer;
}
EPIMIBAConfiguration.java 文件源码 项目:HAIBA-EPIMIBA-classification 阅读 20 收藏 0 点赞 0 评论 0
@Bean
public static CustomScopeConfigurer scopeConfigurer() {
    return new SimpleThreadScopeConfigurer();
}


问题


面经


文章

微信
公众号

扫码关注公众号