[cdi-dev] Clarification of Any qualifier

Martin Kouba mkouba at redhat.com
Mon Jan 2 03:34:14 EST 2017


Hi John,

I believe the spec (2.3.1. Built-in qualifier types) only deals with 
built-in kinds of beans here. In other words, an author of a custom 
implementation of Bean is responsible for providing the complete set of 
qualifiers (i.e. adding @Any).

Weld also does not add @Any to a custom bean automatically. The 
difference is in CDI.current() qualifiers, see also 
https://issues.jboss.org/browse/CDI-671?focusedCommentId=13339043&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13339043.

Martin

Dne 28.12.2016 v 15:53 John Ament napsal(a):
> Hi,
>
>
> So an issue came up with OWB and programmatic look up.
>
>
> In OWB, when you use CDI.current() the instance you get back includes an
> any qualifier.  I do a programmatic look up of a custom bean that is
> registered with just a single qualifier - @Database.  OWB looks up an
> instance that has qualifiers Any and Database, but cannot find any
> because my bean doesn't declare it.
>
>
> My interpretation
> of http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#builtin_qualifiers is that
> the container (OWB) should be adding @Any  to my custom bean even if I
> don't specify it.  Is that the proper interpretation?  Or am I required
> to add @Any to my bean?
>
>
> John
>
>
> ------------------------------------------------------------------------
> NOTICE: This e-mail message and any attachments may contain
> confidential, proprietary, and/or privileged information which should be
> treated accordingly. If you are not the intended recipient, please
> notify the sender immediately by return e-mail, delete this message, and
> destroy all physical and electronic copies. Thank you.
>
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
>

-- 
Martin Kouba
Software Engineer
Red Hat, Czech Republic


More information about the cdi-dev mailing list