0 Replies Latest reply on Jun 13, 2011 2:10 PM by Laird Nelson

    beans.xml location question

    Laird Nelson Apprentice

      I had a question about the location of the META-INF/beans.xml file in a reasonably complicated CDI deployment.

      To simplify the real case: suppose I have a .war file with a lib directory.

      Suppose further that I have a .jar file in there that contains interfaces.

      Next, suppose I have another .jar file in there that contains classes that (a) implement those interfaces and (b) use @Inject on various fields (whose types are interfaces contained in the first jar) to tell the CDI engine (Weld) that injection should be performed.

      My question: how many META-INF/beans.xml files do I need, and where should they be located?

      My expectation: one, and it should be in the second jar only.  That is, the first jar does not need to be blessed as a bean archive.

      Please correct me if I have made any errors.  (An old build of Glassfish using, presumably, an outdated version of Weld once required that even the interface jar contain a META-INF/beans.xml file.  I want to confirm that this was, indeed, a Glassfish bug and not a specification requirement.)