Package org.springframework.beans.factory.config

Examples of org.springframework.beans.factory.config.ConfigurableBeanFactory


  public void testCtorWithJustWhitespacedTargetBeanName() throws Exception {
    testBadTargetBeanName("   ");
  }

  private static void testBadTargetBeanName(final String badTargetBeanName) {
    ConfigurableBeanFactory factory = mock(ConfigurableBeanFactory.class);
    new DefaultScopedObject(factory, badTargetBeanName);
  }
View Full Code Here


    }
  }


  protected List<HandlerMethodArgumentResolver> initArgumentResolvers() {
    ConfigurableBeanFactory beanFactory =
        (ClassUtils.isAssignableValue(ConfigurableApplicationContext.class, getApplicationContext())) ?
            ((ConfigurableApplicationContext) getApplicationContext()).getBeanFactory() : null;

    List<HandlerMethodArgumentResolver> resolvers = new ArrayList<HandlerMethodArgumentResolver>();
View Full Code Here

    return handlerMethod;
  }

  protected List<HandlerMethodArgumentResolver> initArgumentResolvers() {
    List<HandlerMethodArgumentResolver> resolvers = new ArrayList<HandlerMethodArgumentResolver>();
    ConfigurableBeanFactory cbf = (this.beanFactory instanceof ConfigurableBeanFactory ?
        (ConfigurableBeanFactory) this.beanFactory : null);

    // Annotation-based argument resolution
    resolvers.add(new HeaderMethodArgumentResolver(this.conversionService, cbf));
    resolvers.add(new HeadersMethodArgumentResolver());
View Full Code Here

      resource = factory.getBean(name, element.lookupType);
      autowiredBeanNames = Collections.singleton(name);
    }

    if (factory instanceof ConfigurableBeanFactory) {
      ConfigurableBeanFactory beanFactory = (ConfigurableBeanFactory) factory;
      for (String autowiredBeanName : autowiredBeanNames) {
        beanFactory.registerDependentBean(autowiredBeanName, requestingBeanName);
      }
    }

    return resource;
  }
View Full Code Here

      resource = this.resourceFactory.getBean(name, type);
      autowiredBeanNames = Collections.singleton(name);
    }

    if (this.resourceFactory instanceof ConfigurableBeanFactory) {
      ConfigurableBeanFactory beanFactory = (ConfigurableBeanFactory) this.resourceFactory;
      for (Iterator it = autowiredBeanNames.iterator(); it.hasNext();) {
        String autowiredBeanName = (String) it.next();
        beanFactory.registerDependentBean(autowiredBeanName, requestingBeanName);
      }
    }

    return resource;
  }
View Full Code Here

  /**
   * Resolves the specified interceptor names to Advisor objects.
   * @see #setInterceptorNames
   */
  private Advisor[] resolveInterceptorNames() {
    ConfigurableBeanFactory cbf =
        (this.beanFactory instanceof ConfigurableBeanFactory ? (ConfigurableBeanFactory) this.beanFactory : null);
    List advisors = new ArrayList();
    for (int i = 0; i < this.interceptorNames.length; i++) {
      String beanName = this.interceptorNames[i];
      if (cbf == null || !cbf.isCurrentlyInCreation(beanName)) {
        Object next = this.beanFactory.getBean(beanName);
        advisors.add(this.advisorAdapterRegistry.wrap(next));
      }
    }
    return (Advisor[]) advisors.toArray(new Advisor[advisors.size()]);
View Full Code Here

      Introspector.flushCaches();
      //shutdown our jmx agent
      JMXAgent.shutdown();
      //shutdown spring
      FileSystemXmlApplicationContext appContext = (FileSystemXmlApplicationContext) getApplicationContext();
      ConfigurableBeanFactory factory = appContext.getBeanFactory();
      if (factory.containsSingleton("default.context")) {
        for (String scope : factory.getRegisteredScopeNames()) {
          logger.debug("Registered scope: " + scope);
        }
        for (String singleton : factory.getSingletonNames()) {
          logger.debug("Registered singleton: " + singleton);
          //factory.destroyScopedBean(singleton);
        }
        factory.destroySingletons();
      }
      appContext.close();
      //LogFactory.release(Thread.currentThread().getContextClassLoader());
    } catch (Exception e) {
      logger.warn("JBoss could not be stopped", e);
View Full Code Here

    log.debug("Load context - name: " + name + " config: " + config);
    ApplicationContext context = new FileSystemXmlApplicationContext(
        new String[] { config }, parentContext);
    contextMap.put(name, context);
    // add the context to the parent, this will be red5.xml
    ConfigurableBeanFactory factory = ((ConfigurableApplicationContext) applicationContext)
        .getBeanFactory();
    // Register context in parent bean factory
    factory.registerSingleton(name, context);
  }
View Full Code Here

      servletContext
          .setAttribute(
              WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
              applicationContext);

      ConfigurableBeanFactory factory = applicationContext
          .getBeanFactory();
      // register default
      // add the context to the parent
      factory.registerSingleton("default.context", applicationContext);

    } catch (Throwable e) {
      logger.error("", e);
    }
View Full Code Here

      JMXAgent.shutdown();
      // shutdown spring
      // get web application context from the servlet context
      ConfigurableWebApplicationContext applicationContext = (ConfigurableWebApplicationContext) servletContext
          .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
      ConfigurableBeanFactory factory = applicationContext
          .getBeanFactory();
      if (factory.containsSingleton("default.context")) {
        for (String scope : factory.getRegisteredScopeNames()) {
          logger.debug("Registered scope: " + scope);
        }
        for (String singleton : factory.getSingletonNames()) {
          logger.debug("Registered singleton: " + singleton);
          // factory.destroyScopedBean(singleton);
        }
        factory.destroySingletons();
      }
      servletContext
          .removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
      applicationContext.close();
      // http://jakarta.apache.org/commons/logging/guide.html#Classloader_and_Memory_Management
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.config.ConfigurableBeanFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.