Package org.springframework.beans.factory.access

Examples of org.springframework.beans.factory.access.BeanFactoryLocator


    String locatorFactorySelector = servletContext.getInitParameter(LOCATOR_FACTORY_SELECTOR_PARAM);
    String parentContextKey = servletContext.getInitParameter(LOCATOR_FACTORY_KEY_PARAM);

    if (parentContextKey != null) {
      // locatorFactorySelector may be null, indicating the default "classpath*:beanRefContext.xml"
      BeanFactoryLocator locator = ContextSingletonBeanFactoryLocator.getInstance(locatorFactorySelector);
      Log logger = LogFactory.getLog(ContextLoader.class);
      if (logger.isDebugEnabled()) {
        logger.debug("Getting parent context definition: using parent context key of '" +
            parentContextKey + "' with BeanFactoryLocator");
      }
      this.parentContextRef = locator.useBeanFactory(parentContextKey);
      parentContext = (ApplicationContext) this.parentContextRef.getFactory();
    }

    return parentContext;
  }
View Full Code Here


   */
  @Override
  @Test
  public void testGetInstance() {
    // Try with and without 'classpath*:' prefix, and with 'classpath:' prefix.
    BeanFactoryLocator facLoc = ContextSingletonBeanFactoryLocator.getInstance(
        ClassUtils.addResourcePathToPackagePath(CLASS, CONTEXT));
    getInstanceTest1(facLoc);

    facLoc = ContextSingletonBeanFactoryLocator.getInstance(
        "classpath*:" + ClassUtils.addResourcePathToPackagePath(CLASS, CONTEXT));
View Full Code Here

  /*
   * Class to test for BeanFactoryLocator getInstance()
   */
  public void testGetInstance() {
    BeanFactoryLocator bf = DefaultLocatorFactory.getInstance();
    BeanFactoryLocator bf2 = DefaultLocatorFactory.getInstance();
    assertTrue(bf.equals(bf2));
  }
View Full Code Here

  /*
   * Class to test for BeanFactoryLocator getInstance(String)
   */
  public void testGetInstanceString() {
    BeanFactoryLocator bf = DefaultLocatorFactory.getInstance("my-bean-refs.xml");
    BeanFactoryLocator bf2 = DefaultLocatorFactory.getInstance("my-bean-refs.xml");
    assertTrue(bf.equals(bf2));
  }
View Full Code Here

    synchronized (instances) {
      if (logger.isTraceEnabled()) {
        logger.trace("ContextSingletonBeanFactoryLocator.getInstance(): instances.hashCode=" +
            instances.hashCode() + ", instances=" + instances);
      }
      BeanFactoryLocator bfl = instances.get(resourceLocation);
      if (bfl == null) {
        bfl = new ContextSingletonBeanFactoryLocator(resourceLocation);
        instances.put(resourceLocation, bfl);
      }
      return bfl;
View Full Code Here

    String locatorFactorySelector = servletContext.getInitParameter(LOCATOR_FACTORY_SELECTOR_PARAM);
    String parentContextKey = servletContext.getInitParameter(LOCATOR_FACTORY_KEY_PARAM);

    if (parentContextKey != null) {
      // locatorFactorySelector may be null, indicating the default "classpath*:beanRefContext.xml"
      BeanFactoryLocator locator = ContextSingletonBeanFactoryLocator.getInstance(locatorFactorySelector);
      Log logger = LogFactory.getLog(ContextLoader.class);
      if (logger.isDebugEnabled()) {
        logger.debug("Getting parent context definition: using parent context key of '" +
            parentContextKey + "' with BeanFactoryLocator");
      }
      this.parentContextRef = locator.useBeanFactory(parentContextKey);
      parentContext = (ApplicationContext) this.parentContextRef.getFactory();
    }

    return parentContext;
  }
View Full Code Here

    } else if (webInf == null) {
      // No WEB-INF directory found, register as default application
      log.info("No WEB-INF directory found for "
          + context.getContextPath()
          + ", creating default application.");
      BeanFactoryLocator bfl = ContextSingletonBeanFactoryLocator
          .getInstance("red5.xml");
      BeanFactoryReference bfr = bfl.useBeanFactory("red5.common");

      // Create WebScope dynamically
      WebScope scope = new WebScope();
      IServer server = (IServer) bfr.getFactory().getBean(IServer.ID);
      scope.setServer(server);
View Full Code Here

    String locatorFactorySelector = servletContext.getInitParameter(LOCATOR_FACTORY_SELECTOR_PARAM);
    String parentContextKey = servletContext.getInitParameter(LOCATOR_FACTORY_KEY_PARAM);

    if (parentContextKey != null) {
      // locatorFactorySelector may be null, indicating the default "classpath*:beanRefContext.xml"
      BeanFactoryLocator locator = ContextSingletonBeanFactoryLocator.getInstance(locatorFactorySelector);
      Log logger = LogFactory.getLog(ContextLoader.class);
      if (logger.isDebugEnabled()) {
        logger.debug("Getting parent context definition: using parent context key of '" +
            parentContextKey + "' with BeanFactoryLocator");
      }
      this.parentContextRef = locator.useBeanFactory(parentContextKey);
      parentContext = (ApplicationContext) this.parentContextRef.getFactory();
    }

    return parentContext;
  }
View Full Code Here

  @Before
  public void setUp() {
    StepExecutionCountingDecider.previousStepCount = 0;

    if(jobExplorer == null) {
      BeanFactoryLocator beanFactoryLocactor = ContextSingletonBeanFactoryLocator.getInstance();
      BeanFactoryReference ref = beanFactoryLocactor.useBeanFactory("baseContext");
      baseContext = (ApplicationContext) ref.getFactory();

      baseContext.getAutowireCapableBeanFactory().autowireBeanProperties(this,
          AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false);
    }
View Full Code Here

   * Public constructor used by {@link BatchRuntime#getJobOperator()}.  This will bootstrap a
   * singleton ApplicationContext if one has not already been created (and will utilize the existing
   * one if it has) to populate itself.
   */
  public JsrJobOperator() {
    BeanFactoryLocator beanFactoryLocactor = ContextSingletonBeanFactoryLocator.getInstance();
    BeanFactoryReference ref = beanFactoryLocactor.useBeanFactory("baseContext");
    baseContext = (ApplicationContext) ref.getFactory();

    baseContext.getAutowireCapableBeanFactory().autowireBeanProperties(this,
        AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false);

View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.access.BeanFactoryLocator

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.