[seam-dev] Overriding annotated types and the SPI

Pete Muir pmuir at redhat.com
Wed Nov 25 08:47:24 EST 2009


I'm still ploughing through email backlog, exhaustion, housework, paperwork, and other tasks ;-) but I am hopeful that Thanksgiving will give me time to catch up and I can start fixing bugs in Weld this week.

On 23 Nov 2009, at 22:29, Stuart Douglas wrote:

> I have managed to work around this by storing a Set of every java class I have registered and the vetoing the bean when it comes up bean discovery. Any idea when this will be fixed? I could work around it properly by generating a new class using javassist for every bean I add with the SPI, however I would rather not go down that route.
> 
> Stuart
> ________________________________________
> From: Pete Muir [pmuir at redhat.com]
> Sent: Tuesday, 24 November 2009 4:04 AM
> To: Gavin King
> Cc: Stuart Douglas; seam-dev at lists.jboss.org
> Subject: Re: [seam-dev] Overriding annotated types and the SPI
> 
> Yes, this is a bug for sure :-)
> 
> https://jira.jboss.org/jira/browse/WELD-309
> 
> On 23 Nov 2009, at 16:52, Gavin King wrote:
> 
>> Pete, there are allowed to be two AnnotatedTypes for the same Java class.
>> 
>> On Mon, Nov 23, 2009 at 8:17 AM, Pete Muir <pmuir at redhat.com> wrote:
>>> I guess what you are seeing is bug in Weld, whereby we need to adjust quite what makes two annotated types equal so that you see both the one you added, and the new one, rather than only getting one or the other. Even with this fix, you would have an error, as you now have two identical classes which Weld will discover beans for. You need to veto the built in annotated type (otherwise you end up *adding* an existing annotated type, not replacing it).
>>> 
>>> On 23 Nov 2009, at 07:37, Stuart Douglas wrote:
>>> 
>>>> I am trying to register an additional bean. It works perfectly when the class is not in a bean deployment archive, however if QualifiedBean2 is in a bean deployment archive then it stops working. The bean itself does not have any annotations.
>>>> 
>>>> Stuart
>>>> 
>>>> 
>>>> ________________________________________
>>>> From: Gavin King [gavin.king at gmail.com]
>>>> Sent: Monday, 23 November 2009 6:29 PM
>>>> To: Stuart Douglas
>>>> Cc: seam-dev at lists.jboss.org
>>>> Subject: Re: [seam-dev] Overriding annotated types and the SPI
>>>> 
>>>> Are you trying to:
>>>> 
>>>> (a) *override* the bean that the container creates, or
>>>> (b) are you trying to register additional beans?
>>>> 
>>>> If (a), you would need to call veto() on the AnnotatedType created by
>>>> the container.
>>>> 
>>>> On Mon, Nov 23, 2009 at 1:19 AM, Stuart Douglas
>>>> <stuart at baileyroberts.com.au> wrote:
>>>>> I have been working on my XML configuration extension and have been making good progress, however I have run into some behavior that I cannot explain.
>>>>> At the moment in my XML file I can do this:
>>>>> 
>>>>> 
>>>>>  <test:OtherQualifier>
>>>>>      <Qualifier/>
>>>>>  </test:OtherQualifier>
>>>>> 
>>>>> <test:QualifiedBean2>
>>>>>      <test:OtherQualifier value1="BB" value2="2"/>
>>>>>  </test:QualifiedBean2>
>>>>> 
>>>>> <test:QualifierTestBean>
>>>>>   <test:bean2>
>>>>>          <test:OtherQualifier value1="BB" value2="2"/>
>>>>>          <Inject/>
>>>>>   </test:bean2>
>>>>> </test:QualifierTestBean>
>>>>> 
>>>>> When my extension sees this it creates two AnnotatedTypes and a Qualifier and registers them in the BeforeBeanDiscovery event. This all works fine, QualifiedBean2 gets injected into QualifierTestBean and life is good.
>>>>> However if QualifiedBean2 is deployed inside a Bean archive things suddenly go pear shaped, all of a sudden the container seems to forget about the qualifier on QualifiedBean2 and it stops working. Does anyone have any idea what could be causing this? It looks like the bean deployment process is overriding my user supplied type level metadata.
>>>>> 
>>>>> Thanks,
>>>>> 
>>>>> Stuart
>>>>> _______________________________________________
>>>>> seam-dev mailing list
>>>>> seam-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Gavin King
>>>> gavin.king at gmail.com
>>>> http://in.relation.to/Bloggers/Gavin
>>>> http://hibernate.org
>>>> http://seamframework.org
>>>> 
>>>> _______________________________________________
>>>> seam-dev mailing list
>>>> seam-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>> 
>>> 
>> 
>> 
>> 
>> --
>> Gavin King
>> gavin.king at gmail.com
>> http://in.relation.to/Bloggers/Gavin
>> http://hibernate.org
>> http://seamframework.org
> 




More information about the seam-dev mailing list