This article covers a Bloomreach Experience Manager version 13. There's an updated version available that covers our most recent release.

Using Spring Root WebApplicationContext in HST

This feature is available since version 12.2.0

If you have a Spring Root WebApplicationContext in your (HST) site webapp, you typically have in the web.xml the following listener:

  <!-- Bootstrap listener to start up root web application context. -->
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

If you want your Spring Root WebApplicationContext to be able  to access HST Spring Component beans, you need to use HstDelayedContextLoaderListener instead of ContextLoaderListener and make sure it is located after HstContextLoaderListener as follows:

  <!-- HstContextLoaderListener configuring/initializing/destroying HST Container -->
  <listener>
    <listener-class>org.hippoecm.hst.site.container.HstContextLoaderListener</listener-class>
  </listener>

  <!-- Bootstrap listener to start up root web application context. -->
  <listener>
    <listener-class>org.hippoecm.hst.site.container.HstDelayedContextLoaderListener</listener-class>
  </listener>

The reason that you need to use HstDelayedContextLoaderListener instead of ContextLoaderListener is that the HstDelayedContextLoaderListener waits with initializing the Spring Root WebApplicationContext until the HST Spring Component Manager has become available. Since Bloomreach Experience Manager 12.2, the initialization of the HST Spring Component Manager is delayed until the repository has become available, therefore the HstDelayedContextLoaderListener has been introduced.

Use the  HstDelayedContextLoaderListener instead of  ContextLoaderListener if you need to access HST Spring Component Manager beans from the Spring Root WebApplicationContext.

Note that when using the HstDelayedContextLoaderListener, it is not allowed to configure in the site web.xml:

<context-param>
  <param-name>hst-lazy-configuration-loading</param-name>
  <param-value>true</param-value>
</context-param>

See PingFilter for more information.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?