Search

26.8. Spring Application Context as a Seam Component

download PDF
Although it is possible to use the Spring ContextLoaderListener to start your application's Spring ApplicationContext, there are some limitations: the Spring ApplicationContext must be started after the SeamListener, and starting a Spring ApplicationContext for use in Seam unit and integration tests can be complicated.
To overcome these limitations, the Spring integration includes a Seam component that can start a Spring ApplicationContext. To use this component, place the <spring:context-loader/> definition in the components.xml file. Specify your Spring context file location in the config-locations attribute. If more than one configuration file is required, you can place them in the nested <spring:config-locations/> element, as per standard components.xml multi-value practices.
<components xmlns="http://jboss.com/products/seam/components"
            xmlns:spring="http://jboss.com/products/seam/spring"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation=
              "http://jboss.com/products/seam/components
               http://jboss.com/products/seam/components-2.2.xsd
               http://jboss.com/products/seam/spring
               http://jboss.com/products/seam/spring-2.2.xsd">

  <spring:context-loader config-locations=
                           "/WEB-INF/applicationContext.xml"/>

</components>
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.