[cdi-dev] @ThreadScoped?

Mark Struberg struberg at yahoo.de
Sun Mar 20 17:03:05 EDT 2016



Sorry for my brevity. Was on a cellphone only.


My point is: Context#get(Bean<T>) and Bean<T> only has getScope() which looks like

public Class<? extends Annotation> getScope();

Thus having something like

@RequestScoped(allowMultithreads=true)
public class BlaBlaController {..}

would get represented by a Bean<BlaBlaController> which could only return RequestScoped.class.
There is simply no way to return the "allowMultithreads=true" information somewhere as we only deal with Classes.

The same applies to BeanManager#getContext():

public Context getContext(Class<? extends Annotation> scope);


No Annotation but Class, you see?

-> Currently there is no way to evaluate an additional attribute on a scope annotation.


And thus section 2.4.2 of the CDI specification also clearly states
"A scope type must not have any attributes. If a scope type has attributes non-portable behavior results."

roger?

LieGrue,
strub




On Sunday, 20 March 2016, 21:12, Romain Manni-Bucau <rmannibucau at gmail.com> wrote:
>
>Le 20 mars 2016 21:07, "Mark Struberg" <struberg at yahoo.de> a écrit :
>>
>> See Bean#getScope() and BeanManager#getContext()
>>
>> Just uses Class and no Annotation instance.
>>
>That's ok I think. Since 1.2 you can get meta from any bean and find it if needee but i  most of cases the context will see the bean and will not need it.
>Would also break the Annotated contravt if true.
>> Lgm
>>
>>



More information about the cdi-dev mailing list