2 Replies Latest reply on Dec 18, 2008 12:08 AM by rshan.bob.shanahan.alascorp.com

    overriding Seam components

    rshan.bob.shanahan.alascorp.com

      I'd like to override the Spring ContextLoader. I wrote a specialized context loader with the following annotations:



      @Scope(ScopeType.APPLICATION)
      @BypassInterceptors
      @Startup(depends = "org.jboss.seam.ioc.spring.springELResolver")
      @Name("org.jboss.seam.ioc.spring.contextLoader")
      @Install(value = false, precedence = APPLICATION)
      public class ContextLoader
      


      I thought that setting the @Install precedence to APPLICATION would override the framework's precedence of BUILT-IN and allow my ContextLoader to take over. Moreover, I figured I'd see log output indicating that 2 components with the same name were found and that Seam would be using the component with the higher precedence. Instead, log output indicates that the original framework ContextLoader is loaded.



      17:11:04,956 INFO  [Component] Component: org.jboss.seam.ioc.spring.contextLoader, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.ioc.spring.ContextLoader
      


      Are some components not overridable? Or is my config wrong?


      Would very much appreciate some guidance.

        • 1. Re: overriding Seam components
          rshan.bob.shanahan.alascorp.com

          I changed the install value to true


          @Install(value = true, precedence = APPLICATION)
          


          and now I see a log message stating that 2 components were found with the same name and same precedence, which causes Seam startup to fail.


          The Seam ContextLoader config actually looks like this:



          @Scope(ScopeType.APPLICATION)
          @BypassInterceptors
          @Startup(depends="org.jboss.seam.ioc.spring.springELResolver")
          @Name("org.jboss.seam.ioc.spring.contextLoader")
          @Install(value = false, precedence = BUILT_IN)
          public class ContextLoader
          


          Is this a bug?


          • 2. Re: overriding Seam components
            rshan.bob.shanahan.alascorp.com

            I verified that the BUILT-IN ContextLoader's precedence was actually 20 (APPLICATION), even though its source file has the following annotations:



            @Scope(ScopeType.APPLICATION)
            @BypassInterceptors
            @Startup(depends="org.jboss.seam.ioc.spring.springELResolver")
            @Name("org.jboss.seam.ioc.spring.contextLoader")
            @Install(value = false, precedence = BUILT_IN)
            public class ContextLoader
            



            Hence the startup failure. Changing my component's precedence to DEPLOYMENT (30) allowed it to override the BUILT-IN.


            This seems to be a bug, unless there is some other configuration I'm overlooking.