Package org.springframework.beans.factory.access

Examples of org.springframework.beans.factory.access.BeanFactoryReference.release()


    // nobody used the reference
   
    BeanFactoryReference ref1;
    try {
      ref1 = locator1.useBeanFactory(INSTANCE_1);
      ref1.release();
      BeanFactoryReference ref2 = locator2.useBeanFactory(INSTANCE_2);
      ref2.release();

    }
    catch (IllegalArgumentException e) {
View Full Code Here


    BeanFactoryReference ref1;
    try {
      ref1 = locator1.useBeanFactory(INSTANCE_1);
      ref1.release();
      BeanFactoryReference ref2 = locator2.useBeanFactory(INSTANCE_2);
      ref2.release();

    }
    catch (IllegalArgumentException e) {
      // it's okay
    }
View Full Code Here

    // verify aliases
    assertSame(alias1, alias2);
    assertSame(factory1, alias1);

    aliasRef1.release();
    aliasRef2.release();
    reference1.release();
    reference2.release();
  }

  public void testFactoryLocatorDefault() {
View Full Code Here

 
  public void testBeanFactoryLocatorContract() {
    BeanFactoryReference factory1 = locator1.useBeanFactory(INSTANCE_1);
    assertNotNull(factory1.getFactory());

    factory1.release();
    try {
      factory1.getFactory();
      fail("should have received exception");
    }
    catch (IllegalArgumentException e) {
View Full Code Here

    // nobody used the reference
   
    BeanFactoryReference ref1;
    try {
      ref1 = locator1.useBeanFactory(INSTANCE_1);
      ref1.release();
      BeanFactoryReference ref2 = locator2.useBeanFactory(INSTANCE_2);
      ref2.release();

    }
    catch (IllegalArgumentException e) {
View Full Code Here

    BeanFactoryReference ref1;
    try {
      ref1 = locator1.useBeanFactory(INSTANCE_1);
      ref1.release();
      BeanFactoryReference ref2 = locator2.useBeanFactory(INSTANCE_2);
      ref2.release();

    }
    catch (IllegalArgumentException e) {
      // it's okay
    }
View Full Code Here

    // verify aliases
    assertSame(alias1, alias2);
    assertSame(factory1, alias1);

    aliasRef1.release();
    aliasRef2.release();
    reference1.release();
    reference2.release();
  }

  public void testFactoryLocatorDefault() {
View Full Code Here

  // fix this one
  public void testBeanFactoryLocatorContract() {
    BeanFactoryReference factory1 = locator1.useBeanFactory(INSTANCE_1);
    assertNotNull(factory1.getFactory());

    factory1.release();
    try {
      factory1.getFactory();
      fail("should have received exception");
    }
    catch (IllegalArgumentException e) {
View Full Code Here

    try {
      return factory.getFactory();
    }
    finally {
      factory.release();
    }
  }

  /**
   * Find the beanName inside the Spring container.
View Full Code Here

   * @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

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.