Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.context.access
Class ContextBeanFactoryReference

    java.lang.Object
      org.springframework.context.access.ContextBeanFactoryReference

All Implemented Interfaces:
  BeanFactoryReference

    public class ContextBeanFactoryReference

extends Object
implements BeanFactoryReference

ApplicationContext-specific implementation of BeanFactoryReference, wrapping a newly created ApplicationContext, closing it on release.

As per BeanFactoryReference contract, `release` may be called more than once, with subsequent calls not doing anything. However, calling `getFactory` after a `release` call will cause an exception.

Since:
  13.02.2004
Author:
  Juergen Hoeller, Colin Sampaleanu
See Also:
  `ConfigurableApplicationContext.close()`

Constructor Summary
`ContextBeanFactoryReference(ApplicationContext applicationContext)` Create a new ContextBeanFactoryReference for the given context.

Method Summary
`BeanFactory` | `getFactory()` Return the `BeanFactory` instance held by this reference.
`void` | `release()` Indicate that the `BeanFactory` instance referred to by this object is not needed any longer by the client code which obtained the `BeanFactoryReference`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ContextBeanFactoryReference

    public ContextBeanFactoryReference(ApplicationContext applicationContext)

  Create a new ContextBeanFactoryReference for the given context.

  Parameters:
    `applicationContext` - the ApplicationContext to wrap

Method Detail

### getFactory

    public BeanFactory getFactory()

  Description copied from interface: `BeanFactoryReference`
  Return the `BeanFactory` instance held by this reference.

  Specified by:
    `getFactory` in interface `BeanFactoryReference`

### release

    public void release()

  Description copied from interface: `BeanFactoryReference`
  Indicate that the `BeanFactory` instance referred to by this object is not needed any longer by the client code which obtained the `BeanFactoryReference`.

  Depending on the actual implementation of `BeanFactoryLocator`, and the actual type of `BeanFactory`, this may possibly not actually do anything; alternately in the case of a 'closeable' `BeanFactory` or derived class (such as `ApplicationContext`) may 'close' it, or may 'close' it once no more references remain.

  In an EJB usage scenario this would normally be called from `ejbRemove()` and `ejbPassivate()`.

  This is safe to call multiple times.

  Specified by:
    `release` in interface `BeanFactoryReference`
  See Also:
    `BeanFactoryLocator`, `ContextBeanFactoryReference`, `ConfigurableApplicationContext.close()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2008 The Spring Framework.