java - Excluding a CDI Bean based on a PropertyFileConfig (DeltaSpike, WebSphere 8.5.5) -
i trying exclude bean implementation using deltaspike 1.0 @exclude
-annotation. exclusion should based on property value this:
@exclude(onexpression = "providerimplementation!=mock")
i created propertyfileconfig
returning .properties
file name let deltaspike pick configured value , used @exclude
in 2 different implementing beans, each of them being excluded above.
the configuration included in ear .jar
file , both implementations sit in different .jar
files inside ear.
i trying deploy whole archive onto websphere 8.5.5 server , on startup javax.enterprise.inject.ambiguousresolutionexception
injection point.
it seems me propertyfileconfig
not picked before expression resolution, although found references kind of pattern (http://deltaspike.apache.org/core.html#exclude , https://groups.google.com/forum/#!topic/java-config/xslemkst3ru), wonder what's wrong setup.
first answer :
unfortunately, properties defined via propertyfileconfig facility can't used @exclude.
that's because extension configurationextension registers propertyfileconfig @ end of container initialization (which problably mandatory propertyfileconfig classes used cdi beans)
instead have use default configsource implementations : http://deltaspike.apache.org/documentation/configuration.html#_configsources_provided_by_default or create own custom configsource
in particular quick workaround here, defined property in default property file : meta-inf/apache-deltaspike.properties
instead of custom property file
edit :
in fact previous answer incomplete (at least last version of deltaspike (1.3.0 today)) : javadoc propertyfileconfig documents limitation , shows way configure custom property files using serviceloader facility : http://deltaspike.apache.org/javadoc/1.3.0/org/apache/deltaspike/core/api/config/propertyfileconfig.html
Comments
Post a Comment