2 Replies Latest reply on Oct 24, 2013 7:48 AM by bam

    CDI: Compose beans.xml from multiple configuration files

    bam

      Hello,

       

      is it possible to have a CDI beans.xml composed from multiple configuration files?

      E.g. if an application is composed of several modules and I want to keep all configurations (like excluding packages) maintained by the modules.

      Something like

      module1/beans.xml

      module2/beans.xml

       

      I am thinking of two approaches:

      1. import-statements within a common beans.xml, importing the modules beans.xml
      2. instead of one common beans.xml, having possibility to specify a list of beans.xml files

       

      Thanks in advance for any help!

        • 1. Re: CDI: Compose beans.xml from multiple configuration files
          mkouba

          Hi Matthias,

          I'm not sure I completely understand your question. However it's not possible to use any "import" statements in beans.xml. In fact CDI defines a concept of bean archive. The bean archives might be EJB jars, library jars, WEB-INF/classes directory, etc. (see the spec, 12.1 Bean archives). In CDI 1.0 each bean archive must have its own beans.xml, in CDI 1.1 this requirement only applies to explicit bean archives.

          • 2. Re: CDI: Compose beans.xml from multiple configuration files
            bam

            Hello Martin,

             

            thanks for the quick reply!

            As I understand, if I want to separete the contents of the beans.xml into modules, I have to create an archive for every module.

            Not exactly what I was looking for, but I guess the requirement for splitting an beans.xml file within one archive is not necessary for most applications.

             

            Thanks again for the hint!