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

Using Spring Root WebApplicationContext in HST

This feature is available since Hippo CMS 11.2.8.

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>

The above is for version before CMS 11.2.8 always fine, and also after CMS 11.2.8 if your Spring Root WebApplicationContext does not need to access HST Spring Component Beans. If however you run CMS 11.2.8 and have configured in the site web.xml the CMS 11.2.8 newly added options:

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

  <context-param>
    <param-name>hst-wait-for-repository-to-start</param-name>
    <param-value>true</param-value>
  </context-param>

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

  <!-- 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 untill the HST Spring Component Manager has become available. Since version CMS 12.2, the initialization of the HST Spring Component Manager is delayed until the repository has become available, therefor 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.

With respect to context parameters hst-lazy-configuration-loading and hst-wait-for-repository-to-start also see PingFilter.

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?