0 Replies Latest reply on Aug 18, 2009 5:25 PM by Robert Shanahan

    utility jars and seam component overrides

    Robert Shanahan Newbie

      Environment:
      JDK 1.6,
      JBoss 5.1.0,
      Seam 2.2.0


      I have an ear project, currently with a single war. I have a utility module/jar with a class that overrides the Spring context loader as follows:


      @Scope(ScopeType.APPLICATION)
      @BypassInterceptors
      @Startup(depends="org.jboss.seam.ioc.spring.springELResolver")
      @Name("org.jboss.seam.ioc.spring.contextLoader")
      @Install(precedence = Install.APPLICATION)
      public class SeamContextLoader
      {
      ...
      }
      



      I have the following in my components.xml:


      <spring:context-loader>
         <spring:config-locations>
            <value>locatorFactorySelector=classpath:com/xyz/services/beanRefFactory.xml</value>
            <value>parentContextKey=xyz.services</value>
            <value>/WEB-INF/applicationContext.xml</value>
         </spring:config-locations>
      </spring:context-loader>
      


      If the custom context loader is deployed within my utility jar it never supersedes the built in, regardless of whether the utility jar is deployed to EAR/lib or WAR/WEB-INF/lib. The only way it works is if I move the custom context loader class to the WAR project and hence deploy it to WAR/WEB-INF/classes. Furthermore, adding class specification to spring:context-loader has the effect of skipping Spring context loading.


      <spring:context-loader class='com.xyz.web.util.SeamContextLoader">
      ...
      </spring:context-loader>
      



      Obviously I'd prefer not to replicate my custom context loader for every webapp. Does this require special classloader config? Would appreciate some insight on how best to manage overriding components.