Yes, that was the case until CDI-2.0 ;)
In CDI 2.0 we sat together at the face2face meeting in Brno and as a team
created the javax.enterprise.inject.spi.InterceptionFactory
This can be used in producerMethods to create a proxy. Simply have the
InterceptionFactory as injection point in the producer method.
public MyStuff createIt(InterceptionFactory<MyStuff> interceptionFactory) {
MyStuff myStuff = new MyStuff(...);
return interceptionFactory
.configure() <- this gives you an AnnotatedTypeConfigurator<MyStuff>
.add(new SomeInterceptorAnnotation())
.createInterceptedInstance(myStuff);
}
The same can be done withIn Bean#create, but you have to get the
InterceptionFactory from the BeanManager.
Imo that's one of the coolest new features of CDI-2.0!
And one of the reasony I'd love to further push the work on TomEE8 ;)
LieGrue,
strub
> Am 20.12.2017 um 08:56 schrieb Arne Limburg <[email protected]>:
>
> Hi Romain, David,
>
> I remember that discussion in the EG and that outcome, too. The conclusion
> was, that 3rd party beans have to define their own interceptor decorator
> stack and create it in Bean#create
>
> Cheers,
> Arne
>
>
> Am 20.12.17 06:49 schrieb "Romain Manni-Bucau" unter
> <[email protected]>:
>
>> Hi David
>>
>> IIRC 3rd party beans - including @Produces - dont support producers (in
>> the
>> spec) since there are fully let to the user. This is why deltaspike has
>> this partialbean interceptor support.
>>
>>
>>
>> Le 20 déc. 2017 04:01, "David Blevins" <[email protected]> a écrit :
>>
>> Looks as though we don't support Interceptors or Decorators for beans
>> added
>> via extension that are not subclasses of AbstractOwbBean.
>>
>> ThirdpartyBeanImpl returns an inner class impl of Producer from
>> getProducer. Since it doesn't extend AbstractProducer it doesn't have the
>> defineInterceptorStack method and we skip it at the time where we would
>> resolve those.
>>
>> Is there a reason we don't have the inner class in ThirdpartyBeanImpl
>> extend AbstractProducer?
>>
>>
>> --
>> David Blevins
>> http://twitter.com/dblevins
>> http://www.tomitribe.com
>