You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Karsten Ohme <ko...@mms-dresden.de> on 2008/04/08 21:04:06 UTC

Same bean injected into different fields

Hi,

The same bean is injected, when I do this:

    @EJB(name = "Foo")
    private SignatureService otherService;

    @EJB(name = "Bar")
    private SignatureService selfService;

Although there are two different implementations with the corresponding
name. Do I do something wrong?

Regards,
Karsten


Re: Same bean injected into different fields

Posted by David Blevins <da...@visi.com>.
Added support for this:

http://issues.apache.org/jira/browse/OPENEJB-828

-David

On Apr 10, 2008, at 1:48 PM, David Blevins wrote:

>
> On Apr 10, 2008, at 1:28 PM, Karsten Ohme wrote:
>
>> I have overseen that I used name instead of beanName. This was the  
>> reason.
>
> I've been poking into this one also.  Though not spec required, I  
> think it'd be neat if we could employ the "name" to break a tie in  
> the case of an ambiguous EJB ref.  We already do that sort of  
> matching for @Resource refs.
>
> -David
>
>
>>
>>
>> Karsten Ohme schrieb:
>>> Hi,
>>> The same bean is injected, when I do this:
>>>   @EJB(name = "Foo")
>>>   private SignatureService otherService;
>>>   @EJB(name = "Bar")
>>>   private SignatureService selfService;
>>> Although there are two different implementations with the  
>>> corresponding
>>> name. Do I do something wrong?
>>> Regards,
>>> Karsten
>>
>>
>
>


Re: Same bean injected into different fields

Posted by David Blevins <da...@visi.com>.
On Apr 10, 2008, at 1:28 PM, Karsten Ohme wrote:

> I have overseen that I used name instead of beanName. This was the  
> reason.

I've been poking into this one also.  Though not spec required, I  
think it'd be neat if we could employ the "name" to break a tie in the  
case of an ambiguous EJB ref.  We already do that sort of matching for  
@Resource refs.

-David


>
>
> Karsten Ohme schrieb:
>> Hi,
>> The same bean is injected, when I do this:
>>    @EJB(name = "Foo")
>>    private SignatureService otherService;
>>    @EJB(name = "Bar")
>>    private SignatureService selfService;
>> Although there are two different implementations with the  
>> corresponding
>> name. Do I do something wrong?
>> Regards,
>> Karsten
>
>


Re: Same bean injected into different fields

Posted by Karsten Ohme <wi...@t-online.de>.
I have overseen that I used name instead of beanName. This was the reason.

Karsten Ohme schrieb:
> Hi,
> 
> The same bean is injected, when I do this:
> 
>     @EJB(name = "Foo")
>     private SignatureService otherService;
> 
>     @EJB(name = "Bar")
>     private SignatureService selfService;
> 
> Although there are two different implementations with the corresponding
> name. Do I do something wrong?
> 
> Regards,
> Karsten
> 
> 
>