-
1. Re: @Stateless @LocalBean not discovered as a CDI Bean
mkouba May 18, 2015 4:14 AM (in response to dabloem)Hi Duncan,
first of all you don't have to annotate the SLSB with
@LocalBean
. For a session bean, the observer method must be either a business method (i.e. declared on thePaymentProcessor
in your case) or a static method (see also 10.4. Observer methods). Also the SLSB is still discovered even if annotated with@LocalBean
but if it has a no-interface view the set of bean types only contains bean class, all superclasses andjava.lang.Object
(see also 3.2.2. Bean types of a session bean). So it does not containPaymentProcessor
in your case. -
2. Re: @Stateless @LocalBean not discovered as a CDI Bean
dabloem May 18, 2015 7:14 AM (in response to mkouba)Hi Martin,
But if neither options (business method or static) are possible, annotation with @LocalBean seems reasonable, even though it has/contains a PaymentProcessor interface (see example).
Also, it works on JBoss AS 7.1.1. I don't think this is spec related (CDI 1.0 vs 1.1), but I could be wrong.
Thanks, Duncan
-
3. Re: @Stateless @LocalBean not discovered as a CDI Bean
mkouba May 18, 2015 7:55 AM (in response to dabloem)If you annotate an SLSB with
@LocalBean
the container thinks it exposes a no-interface view, i.e. theonObserve()
method becomes a business method and it's recognized by CDI as an observer. However, the set of bean types of your SLSB only containsCreditCardProcessor
andjava.lang.Object
(this is per the spec). And soInstance<PaymentProcessor>
should be an unsatisfied dependency (unless there's another bean with type PaymentProcessor). -
4. Re: @Stateless @LocalBean not discovered as a CDI Bean
mkouba May 18, 2015 7:58 AM (in response to dabloem)Also, it works on JBoss AS 7.1.1.
This is odd. Let me try your cdi-test...
-
5. Re: @Stateless @LocalBean not discovered as a CDI Bean
mkouba May 18, 2015 9:00 AM (in response to mkouba)Duncan, I did a quick test and you're right in that it works differently on AS7/EAP with Weld 1.1.x. Most probably because there is no proper TCK test for this. In any case, I believe that the current implementation (Weld 2.2+) is correct per the spec and will likely not change.