Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » context » support » [javadoc | source]
org.springframework.context.support
abstract public class: ApplicationObjectSupport [javadoc | source]
java.lang.Object
   org.springframework.context.support.ApplicationObjectSupport

All Implemented Interfaces:
    ApplicationContextAware

Direct Known Subclasses:
    AbstractTemplateViewResolver, AbstractWizardFormController, DefaultAnnotationHandlerMapping, AbstractJExcelView, OrderFormController, TilesConfigurer, AbstractController, AbstractHandlerMapping, AbstractControllerUrlHandlerMapping, AbstractTemplateView, AbstractExcelView, FreeMarkerView, TilesView, JasperReportsCsvView, AbstractPdfView, ParameterizableViewController, SimpleFormController, JasperReportsXlsView, MultiActionController, AbstractCommandController, VelocityViewResolver, JasperReportsPdfView, BeanNameViewResolver, AbstractView, ServletWrappingController, AbstractUrlBasedView, TilesView, AnnotationMethodHandlerAdapter, FreeMarkerViewResolver, WebContentInterceptor, AbstractWizardFormController, RedirectView, AbstractJasperReportsSingleFormatView, AbstractUrlViewController, CancellableFormController, PortletModeParameterHandlerMapping, AbstractCachingViewResolver, PortletContentGenerator, ResourceBundleViewResolver, PortletModeHandlerMapping, AbstractDetectingUrlHandlerMapping, SimpleFormController, AbstractPathMapHandlerMapping, AbstractFormController, InternalResourceViewResolver, ServletForwardingController, AnnotationMethodHandlerAdapter, VelocityLayoutViewResolver, WebApplicationObjectSupport, AbstractHandlerMapping, AbstractMapBasedHandlerMapping, XmlViewResolver, AbstractPdfStamperView, VelocityToolboxView, AbstractCommandController, PortletWrappingController, WebContentGenerator, XsltViewResolver, CommonsPathMapHandlerMapping, JasperReportsHtmlView, BeanNameUrlHandlerMapping, BaseCommandController, AbstractFormController, UrlBasedViewResolver, ParameterizableViewController, VelocityLayoutView, DefaultAnnotationHandlerMapping, AbstractJasperReportsView, VelocityView, JasperReportsViewResolver, JstlView, ConfigurableJasperReportsView, AbstractXsltView, AbstractUrlHandlerMapping, XsltView, AccountFormController, TilesJstlView, PortletApplicationObjectSupport, SimpleUrlHandlerMapping, InternalResourceView, AbstractClinicForm, JasperReportsMultiFormatView, ControllerBeanNameHandlerMapping, BaseCommandController, ControllerClassNameHandlerMapping, UrlFilenameViewController, ParameterHandlerMapping, AbstractController

Convenient superclass for application objects that want to be aware of the application context, e.g. for custom lookup of collaborating beans or for context-specific resource access. It saves the application context reference and provides an initialization callback method. Furthermore, it offers numerous convenience methods for message lookup.

There is no requirement to subclass this class: It just makes things a little easier if you need access to the context, e.g. for access to file resources or to the message source. Note that many application objects do not need to be aware of the application context at all, as they can receive collaborating beans via bean references.

Many framework classes are derived from this class, particularly within the web support.

Field Summary
protected final  Log logger    Logger that is available to subclasses 
Method from org.springframework.context.support.ApplicationObjectSupport Summary:
getApplicationContext,   getMessageSourceAccessor,   initApplicationContext,   initApplicationContext,   isContextRequired,   requiredContextClass,   setApplicationContext
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.context.support.ApplicationObjectSupport Detail:
 public final ApplicationContext getApplicationContext() throws IllegalStateException 
    Return the ApplicationContext that this object is associated with.
 protected final MessageSourceAccessor getMessageSourceAccessor() throws IllegalStateException 
    Return a MessageSourceAccessor for the application context used by this object, for easy message access.
 protected  void initApplicationContext() throws BeansException 
 protected  void initApplicationContext(ApplicationContext context) throws BeansException 
    Subclasses can override this for custom initialization behavior. Gets called by setApplicationContext after setting the context instance.

    Note: Does not get called on reinitialization of the context but rather just on first initialization of this object's context reference.

    The default implementation calls the overloaded #initApplicationContext() method without ApplicationContext reference.

 protected boolean isContextRequired() 
    Determine whether this application object needs to run in an ApplicationContext.

    Default is "false". Can be overridden to enforce running in a context (i.e. to throw IllegalStateException on accessors if outside a context).

 protected Class requiredContextClass() 
    Determine the context class that any context passed to setApplicationContext must be an instance of. Can be overridden in subclasses.
 public final  void setApplicationContext(ApplicationContext context) throws BeansException