5 Replies Latest reply on Dec 16, 2009 1:49 PM by pmuir

    CDI and EE modules

    william.drai

      The behaviour of CDI with jar modules inside an ear is not very clear.


      What I've observed in JBoss 6M1 is that any bean of any module can be injected in any bean of any module. I'm perfectly happy with that but this is not what the spec seems to say in 5.1. Could someone clarify exactly how exactly this is supposed to work.

        • 1. Re: CDI and EE modules
          swd847


          Beans packaged in a certain Java EE module or library are available for injection, lookup and EL resolution to classes and
          JSP/JSF pages packaged in some other Java EE module or library if and only if the first module or library is required to be
          accessible to the other module or library by the Java EE platform specification.


          Jars packaged inside an ear are accessible to one another. Classes deployerd inside a war are not accessible to other modules.

          • 2. Re: CDI and EE modules
            gavin.king

            any bean of any module can be injected in any bean of any module.

            Nope, only if the first module is in the classpath of the second module.


            If module A has a bean X and is not in the classpath of module B, beans in B cannot inject X.

            • 3. Re: CDI and EE modules
              william.drai

              Gavin, indeed that's what I have understood but from what I see in my project it does not seem to be the case in JBoss 6.


              Of course if what Stuart says is right, there is no problem but I thought jars were isolated from each other and classpath entries in the manifest file were required to define classloader dependencies. Has this changed in JEE5 or JEE6 ?

              • 4. Re: CDI and EE modules
                gavin.king

                Correct. Unless you put stuff in the .ear/lib directory, in which case they're visible to everything.


                Note that we have not yet released JBoss6, so I'm not sure what the status of this feature is.

                • 5. Re: CDI and EE modules
                  pmuir

                  Gavin King wrote on Nov 26, 2009 23:51:


                  Correct. Unless you put stuff in the .ear/lib directory, in which case they're visible to everything.

                  Note that we have not yet released JBoss6, so I'm not sure what the status of this feature is.


                  Right, this isn't implemented in JBoss AS yet (it is in GlassFish). Ales is going to work on it soon (but xmas is in the way ;-)