My ear application which runs on JBoss AS 7.1.0.Final consists of two jars:
lib/one.jar
lib/two.jar
Both jars are CDI bean archives.
The two.jar
depends on one.jar
.
The class beeing decorated is in one.jar
.
The decorator class is in two.jar
If the decorators are declared in beans.xml
of two.jar
, they are not enabled.
Does this work as expected?
Since the one.jar
is developed independent of the two.jar
and has no dependency to the two.jar
, I expect the declaration (enabling) of the decorators is in the archive where the decorator classes are stored.
How is it possible to enable a decorator class without to change the archive with classes beeing decorated?
According to the spec, yes this is expected behaviour. CDI 1.1 is hoping to make this easier or at least clear it up a little. For any interceptor, decorator, or alternative you want to use, it must be enabled (beans.xml) in the archive you wish to use it.