Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-3639

Need support for hierarchical beanRefFactory in ContextLoader

    Details

    • Type: Feature Request
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.0.GA
    • Fix Version/s: None
    • Component/s: Spring
    • Labels:
      None

      Description

      The Spring ContextLoaderListener allows loading of shared (by multiple wars), hierarchical contexts as in the following sample web.xml config:

      <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/applicationContext.xml</param-value>
      </context-param>
      <context-param>
      <param-name>locatorFactorySelector</param-name>
      <param-value>classpath:com/i2i/services/beanRefFactory.xml</param-value>
      </context-param>
      <context-param>
      <param-name>parentContextKey</param-name>
      <param-value>i2i.services</param-value>
      </context-param>
      <context-param>
      <param-name>webAppRootKey</param-name>
      <param-value>i2i.webt</param-value>
      </context-param>

      <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      </listener>

      The Seam ContextLoader, however, only allows loading of one or more application contexts, neither allowing single instances of shared contexts nor allowing for hierarchical contexts (via setting of parent context key).

      Attempt to overcome the limitation with the following <spring:context-loader> config and beanRefFactory.xml fails as only the beans defined in the beanRefFactory are directly visible to Seam.

      <spring:context-loader>
      <spring:config-locations>
      <value>classpath:com/i2i/services/beanRefFactory.xml</value>
      <value>/WEB-INF/beanRefFactory.xml</value>
      </spring:config-locations>
      </spring:context-loader>

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
      "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
      <beans>
      <bean id="i2i.web" lazy-init="false"
      class="org.springframework.context.support.ClassPathXmlApplicationContext">
      <constructor-arg>
      <list>
      <value>
      /WEB-INF/applicationContext.xml
      </value>
      </list>
      </constructor-arg>
      <constructor-arg>
      <ref bean="i2i.services" />
      </constructor-arg>
      </bean>
      </beans>

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                rshan Bob Shanahan
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: