[weld-dev] CDI and @Singleton

Jozef Hartinger jharting at redhat.com
Fri Nov 22 09:47:38 EST 2013


Yes, it should. Can you point me to the example?

On 11/22/2013 03:38 PM, Bill Burke wrote:
> Arun Gupta has a JAX-RS example using @Singleton.  Resteasy first tries
> to delegate to a CDI beanmanager to create the resource instance before
> it relies on a default mechanism.  Should the BeanManager be recognizing
> @Singleton then?
>
> On 11/22/2013 2:19 AM, Mark Struberg wrote:
>> Hi Bill!
>>
>> This pops up quite often.
>> Actually the spec is pretty much silent on this and defines nothing else than CDI being based on JSR-330. But the TCK defines that any JSR-299 container also must fully pass the JSR-330 TCK as part of the compatibility check.
>>
>> Means CDI containers need to support it, but it is not really defined how it should behave.
>> In OWB we just treat it as alias for @ApplicationScoped. I'm not 100% sure if it's the same for Weld, but I think to remember discussing about it with either Jozef or Pete that they do it effectively the same way. Needs ack from them though.
>>
>> My personal suggestion is to avoid it.
>>
>> There is a slightly broader issue hidden in this topic actually.
>> As per explanation above, each CDI container must also support scopes annotated with @Scope (from atinject, not @NormalScope from CDI). But atinject does nowhere define how to register Contexts for those scopes. In CDI we should do pickup contexts for those scopes but it's probably not well tested nor defined how those contexts should behave.
>> I'd personally would expect them to just get injected without the Contextual Reference proxies but as direct Contextual Instances and otherwise be pretty much the same like standard CDI scopes. But that needs ack + wordig by my fellow CDI EG members.
>>
>>
>> LieGrue,
>> strub
>>
>>
>>
>> ----- Original Message -----
>>> From: Bill Burke <bburke at redhat.com>
>>> To: Weld <weld-dev at lists.jboss.org>
>>> Cc:
>>> Sent: Friday, 22 November 2013, 3:17
>>> Subject: [weld-dev] CDI and @Singleton
>>>
>>> Is Weld or CDI supposed to recognize and support @javax.inject.Singleton
>>> annotated classes?
>>>
>>> --
>>> Bill Burke
>>> JBoss, a division of Red Hat
>>> http://bill.burkecentral.com
>>> _______________________________________________
>>> weld-dev mailing list
>>> weld-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/weld-dev
>>>



More information about the weld-dev mailing list