Yes that's right. I don't want the bean activated directly because the producer
method does some additional logic before activation.
On Friday, January 2, 2015 11:17 AM, Romain Manni-Bucau <rmannibucau(a)gmail.com>
1) yes if the bean is scanned as well
2) you can use @Alternative but using <scan />, @Vetoed, or @Typed()
for CDI 1.0 should work as well and are maybe less hacky since you'll
never activate this alternative right?
2015-01-02 17:02 GMT+01:00 Michael Remijan <mjremijan(a)yahoo.com>:
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.
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?
Is annotating the bean as an @Alternative an acceptable "work around"?
Seems hackish to me. If not, what is the appropriate solution.
cdi-dev mailing list
Note that for all code provided on this list, the provider licenses the code
under the Apache License, Version 2
). For all other ideas
provided on this list, the provider waives all patent and other intellectual
property rights inherent in such information.