Decorators and decorated classes are in different bean archives

My ear app which is running on JBoss AS 7.1.0.Final has two jars:

  • lib/one.jar

  • lib/two.jar

Both flags are CDI bean archives.

two.jar

depends on one.jar

.

A class decorated with style is in one.jar

.

The decorator class is in two.jar

If decorators are declared in beans.xml

two.jar

, they are not included. Does this work as expected?

Since it is one.jar

developed independently of two.jar

and has no dependency on two.jar

, I would expect decorators to be declared (included) in the archive where the decorator classes are stored.

How can one include the decorator class without modifying the decorated class archive?

+3


source to share


1 answer


According to the spec, yes, this is the expected behavior. CDI 1.1 hopes to make this easier, or at least a little clever. For any interceptor, decorator or alternative that you want to use, it must be included (beans.xml) in the archive you want to use.



+5


source







All Articles