Hi Michael,

you may also consider the following possibilities:

1) the class defining producer method is not a bean itself (in CDI 1.2 use beans.xml with both version 1.1 and bean-discovery-mode of annotated and don't apply any bean defining annotation)

2) define a qualifier and use it either on bean or producer method in conjunction with inject

Radim


2015-01-02 17:02 GMT+01:00 Michael Remijan <mjremijan@yahoo.com>:
Greetings,

I recently ran into a situation where I had created a producer method for an object but when Weld was starting up I got errors about something being ambiguous.  I finally tracked the issue to the fact that the bean my producer method was responsible for producing only had a default no-arg constructor.  I was able to "work around" this problem by annotating the bean as an @Alternative.  So I have a few questions.

(1)
Is this expected behavior from CDI? If a bean only has the default no-arg constructor should you get an ambiguous error if you also have a producer method for the bean?

(2)
Is annotating the bean as an @Alternative an acceptable "work around"?  Seems hackish to me. If not, what is the appropriate solution.

Thanks!


_______________________________________________
cdi-dev mailing list
cdi-dev@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.