Hi guys, excuse me for bumping my own message but two days later am still clueless.
Could it possibly be that i may not @Specializes an abstract class? thx for your help! Reinis -----Ursprüngliche Nachricht----- Betreff: [OWB] make @Specializes to work for me Von: [email protected] An: [email protected] Datum: 2013/05/20 11:42:34 Hi guys, in my scenario I want to realize a "template method". For this I implement common abstract base class: public abstract AbstractFooProducer { protected void init() {} @Produces public Foo produceFoo() { init(); return foo; } and then one or more specific implementations: public class XmlFooProducer extends AbstractFooProducer { @Override protected void init() { // wicked xml initialization done here } } Now, this solution is causing me some headache to realize, here are number of wrong assumptions I made: - I assumed that, because AbstractFooProducer is abstract, OWB will activate XmlFooProducer as the only concrete implementation and will recognize @Produces method through the inheritance. No, does not happen! - Ok, next assumption is that if I decorate XmlFooProducer with @Specializes I will get the behavior described above. No and from this point on i always get this same exception from OWB: InconsistentSpecializationException(not sure if the name is correct since am writing this by heart but it is thrown by OWBBeanUtil during configureSpecializations()); - Next, I will add @Alternative on top of @Specializes and activate it to make it work (as described in oracle docs for CDI). Result - the said InconsistentSpecializationException; - Next, I will @Override the @Produces method from abstract class in the concrete implementation (i read some place that specializing class fully "replaces" specialized class and interpreted this so that i have to replicate then all relevant Cdi annotations). No, the same exception is thrown; At this point i am out of ideas and would appretiate a hint or two on how to make it work. br Reinis
