[cdi-dev] Is it required to explicitly add @Any for custom beans?

Martin Kouba mkouba at redhat.com
Tue Feb 4 04:15:48 EST 2014


Hi Gunnar,

I believe it is required.

See the spec section 11.1 The Bean interface:
"getTypes(), getQualifiers(), getScope(), getName() and getStereotypes()
must return the bean types, qualifiers, scope type, bean name and
stereotypes of the bean, as defined in Chapter 2"

I think the sentence you're referencing is rather about class-based
beans, not custom beans.

But it's not very clear.

M


Dne 4.2.2014 09:54, Gunnar Morling napsal(a):
> Hi,
> 
> I'm registering a custom Bean implementation using a portable extension.
> Injection of this bean using the @Any qualifier fails unless I
> explicitly add this qualifier in the getQualifiers() implementation of
> my bean.
> 
> Now the spec says in 2.3.1:
> 
>     "Every bean has the built-in qualifier @Any, even if it does not
> explicitly declare this qualifier [...]"
> 
> Based on that, I had expected that I'm not required to add this
> qualifier to my custom bean implementation. Or am I misinterpreting the
> spec here?
> 
> Thanks,
> 
> --Gunnar
> 
> 
> 
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
> 


More information about the cdi-dev mailing list