+1 OP and responses!
On Sun, May 19, 2013 at 1:24 PM, Romain Manni-Bucau <[email protected]>wrote: > by default your bean will be a managed bean so injectable, just add > anything to prevent it (constructor without @Inject for instance) and > you'll remove the conflict. > > > veto = remove it from cdi (= handled manually) > Typed() = keep it in cdi but for Object type only (as all beans) > > @Any ~= i don't care about details just give me it! > @Default = just because in cdi identity is type + qualifier so we need a > default one ;) > > *Romain Manni-Bucau* > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* > *Blog: **http://rmannibucau.wordpress.com/*< > http://rmannibucau.wordpress.com/> > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* > *Github: https://github.com/rmannibucau* > > > > 2013/5/19 <[email protected]> > > > Thank you guys for the excellent info! > > > > Now that i know what to search for, theres actually some discussion going > > on over this subject in internet. > > > > Although it works for me, i have the feeling that both solutions (@Typed > > and @Veto) are rather workarounds (i saw on stacktrace one more > suggestion > > to annotate the bean to be produced with @Alternative without enabling > it) > > because the intent of those annotations is different(?) > > > > Just for the sake of completeness, why would @Default or @New or @Any > > together with @Produces on producer method will not work? > > > > Br > > Reinis > > > > > > -----Ursprüngliche Nachricht----- > > Betreff: Re: [OWB] CDI - how to realize default producer? > > Von: "Mark Struberg" <[email protected]> > > An: [email protected] > > Datum: 2013/05/19 14:40:52 > > > > Yes, it's kind of different to ProcessAnnotatedType#veto(), but it has > the > > same effect - your class and your producer don't clash anymore ;) > > > > And it comes without any expenses straight out of CDI-1.0 > > > > LieGrue, > > strub > > > > > > > > > > ----- Original Message ----- > > > From: John D. Ament <[email protected]> > > > To: [email protected]; Mark Struberg <[email protected]> > > > Cc: > > > Sent: Sunday, 19 May 2013, 14:14 > > > Subject: Re: [OWB] CDI - how to realize default producer? > > > > > > Well, I think @Typed is another work around. It doesn't remove the > > object > > > from the archive simply says you can't reference it by anything but > > > what's > > > in @Typed. > > > > > > > > > On Sun, May 19, 2013 at 6:19 AM, Mark Struberg <[email protected]> > > wrote: > > > > > >> CDI-1.0 _has_ a concept of vetoing. Simply annotate Foo with > > >> > > >> @Typed() > > >> > > >> LieGrue, > > >> strub > > >> > > >> > > >> > > >> > > >> ----- Original Message ----- > > >> > From: John D. Ament <[email protected]> > > >> > To: [email protected] > > >> > Cc: > > >> > Sent: Sunday, 19 May 2013, 4:37 > > >> > Subject: Re: [OWB] CDI - how to realize default producer? > > >> > > > >> >T he easiest way is to actually put a qualifier on the class itself, > > > and > > >> > then never inject based on that qualifier. CDI 1.0 has no concept > of > > > a > > >> > veto'd bean, but you could write an extension yourself that > > > veto'd your > > >> > class. > > >> > > > >> > Extensions exist out there, I believe CODI has one and Seam3 has > one. > > >> > Seam3 uses @Veto to mark these beans as veto'd. > > >> > > > >> > > > >> > On Sat, May 18, 2013 at 6:48 PM, Reinis Vicups > > > <[email protected]> wrote: > > >> > > > >> >> Hi, > > >> >> > > >> >> I'd like to use a producer method in ALL CASES when > > > @Injecting a > > >> >> particular bean. > > >> >> > > >> >> It looks like this: > > >> >> > > >> >> public class FooProducer { > > >> >> > > >> >> @Produces > > >> >> public Foo produceFoo() { > > >> >> Foo foo = new Foo(); > > >> >> return foo; > > >> >> } > > >> >> } > > >> >> > > >> >> public class Foo {} > > >> >> > > >> >> With this example I get: > > >> >> > > >> >> SEVERE - CDI Beans module deployment failed > > >> >> javax.enterprise.inject.**AmbiguousResolutionException: Ambiguous > > >> >> resolution > > >> >> found beans: > > >> >> Foo, Name:null, WebBeans Type:MANAGED, API > > >> > Types:[....Foo,java.lang.**Object], > > >> >> Qualifiers:[javax.enterprise.**inject.Any,javax.enterprise.** > > >> >> inject.Default] > > >> >> Foo, Name:null, WebBeans Type:PRODUCERMETHOD, API > > >> Types:[....Foo,java.lang. > > >> >> **Object], > > >> Qualifiers:[javax.enterprise.**inject.Any,javax.enterprise.** > > >> >> inject.Default] > > >> >> > > >> >> I tried applying @Default with no success. > > >> >> > > >> >> And I don't want to make specific @Qualifier annotation, > > > because this > > >> > is > > >> >> unnecessary in my case and will cause errors in those cases when > > > I > > >> forget > > >> >> to provide that @Qualifier at injection point. > > >> >> > > >> >> If anyone could help me with setting up a correct way to provide > > >> default > > >> >> producer, would be great. > > >> >> > > >> >> thanks and kind regards > > >> >> Reinis > > >> >> > > >> > > > >> > > > > > > > > > > > > > >
