Examples of BeanFactoryReference


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

   * @see #getBeanFactoryLocatorKey
   * @see org.springframework.beans.factory.access.BeanFactoryLocator#useBeanFactory(String)
   */
  protected BeanFactoryReference getBeanFactoryReference(Object target) {
    String key = getBeanFactoryLocatorKey(target);
    BeanFactoryReference ref = getBeanFactoryLocator(target).useBeanFactory(key);
    this.beanFactoryReferences.put(target, ref);
    return ref;
  }
View Full Code Here

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

  /**
   * Actually release the BeanFactoryReference for the given target bean.
   * @param target the target bean to release
   */
  protected void doReleaseBean(Object target) {
    BeanFactoryReference ref = this.beanFactoryReferences.remove(target);
    if (ref != null) {
      ref.release();
    }
  }
View Full Code Here

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

        "classpath*:" + ClassUtils.addResourcePathToPackagePath(
        SingletonBeanFactoryLocatorTests.class, "ref1.xml"));
   
    basicFunctionalityTest(facLoc);

    BeanFactoryReference bfr = facLoc.useBeanFactory("a.qualified.name.of.some.sort");
    BeanFactory fac = bfr.getFactory();
    assertTrue(fac instanceof ApplicationContext);
    assertEquals("a.qualified.name.of.some.sort", ((ApplicationContext) fac).getId());
    assertEquals("a.qualified.name.of.some.sort", ((ApplicationContext) fac).getDisplayName());
    BeanFactoryReference bfr2 = facLoc.useBeanFactory("another.qualified.name");
    BeanFactory fac2 = bfr2.getFactory();
    assertEquals("another.qualified.name", ((ApplicationContext) fac2).getId());
    assertEquals("another.qualified.name", ((ApplicationContext) fac2).getDisplayName());
    assertTrue(fac2 instanceof ApplicationContext);
  }
View Full Code Here

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

   
    final BeanFactory bf = new StaticListableBeanFactory();
    BeanFactoryLocator bfl = new BeanFactoryLocator() {
      public BeanFactoryReference useBeanFactory(String factoryKey)
          throws FatalBeanException {
        return new BeanFactoryReference() {
          public BeanFactory getFactory() {
            return bf;
          }
          public void release() throws FatalBeanException {
            // nothing to do in default implementation
View Full Code Here

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

    mc.replay();
   
    final BeanFactory bf = new StaticListableBeanFactory();
    BeanFactoryLocator bfl = new BeanFactoryLocator() {
      public BeanFactoryReference useBeanFactory(String factoryKey) throws FatalBeanException {
        return new BeanFactoryReference() {
          public BeanFactory getFactory() {
            return bf;
          }
          public void release() throws FatalBeanException {
            // nothing to do in default implementation
View Full Code Here

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

    mc.replay();
 
    final BeanFactory bf = new StaticListableBeanFactory();
    BeanFactoryLocator bfl = new BeanFactoryLocator() {
      public BeanFactoryReference useBeanFactory(String factoryKey) throws FatalBeanException {
        return new BeanFactoryReference() {
          public BeanFactory getFactory() {
            return bf;
          }
          public void release() throws FatalBeanException {
            // nothing to do in default implementation
View Full Code Here

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

   * @see #getBeanFactoryLocatorKey
   * @see org.springframework.beans.factory.access.BeanFactoryLocator#useBeanFactory(String)
   */
  protected BeanFactoryReference getBeanFactoryReference(Object target) {
    String key = getBeanFactoryLocatorKey(target);
    BeanFactoryReference ref = getBeanFactoryLocator(target).useBeanFactory(key);
    this.beanFactoryReferences.put(target, ref);
    return ref;
  }
View Full Code Here

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

  /**
   * Actually release the BeanFactoryReference for the given target bean.
   * @param target the target bean to release
   */
  protected void doReleaseBean(Object target) {
    BeanFactoryReference ref = this.beanFactoryReferences.remove(target);
    if (ref != null) {
      ref.release();
    }
  }
View Full Code Here

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

     * @param contextName The name of the application context {@link BeanFactory} to return.
     * @return The (singleton) {@link BeanFactory} for the application context.
     */
    public static BeanFactory getApplicationContext(final String contextName) {
        final BeanFactoryLocator locator = SingletonBeanFactoryLocator.getInstance(BEAN_REF_FACTORY_PATH);
        final BeanFactoryReference reference = locator.useBeanFactory(contextName);
        return reference.getFactory();
    }
View Full Code Here

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

    return initFactoryName;
  }

  protected static BeanFactory createBeanFactory(String factoryName) {
    BeanFactoryLocator bfl = ContextSingletonBeanFactoryLocator.getInstance();
    BeanFactoryReference ref = bfl.useBeanFactory(factoryName);
    BeanFactory result = ref.getFactory();
    log.info("ClassFactory has been initialized with beanFactory '" + factoryName + "'");
    return result;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.