To explain this a bit more in depth. 
Our interceptors are pretty much stupid :)

They just forward the _real_ work to a @Dependent CDI bean which does all the 
work

@Inject TheRealWorker worker:

@AroundInvoke
public Object interceptIt(InvocationContext ic) throws Exception {
  return worker.execute(ic);
}


TheRealWorker implements InterceptorStrategy and is usually @Dependent scoped.
That way we can provide an @Alternative or @Specializes for those injected 
strategies.


LieGrue,
strub




----- Original Message -----
> From: Gerhard Petracek <[email protected]>
> To: [email protected]
> Cc: 
> Sent: Friday, December 28, 2012 3:39 AM
> Subject: Re: How to replace and disable Interceptor at runtime.
> 
> hi hantsy,
> 
> in deltaspike (and codi) we are using interceptor-strategies which allow to
> provide alternative (/specialized) interceptor-implementations (see
> org.apache.deltaspike.core.spi.InterceptorStrategy as well as the usage of
> it).
> 
> regards,
> gerhard
> 
> 
> 
> 2012/12/28 hantsy <[email protected]>
> 
>>  Hi all,
>> 
>>  I know there are some way to use alternative Managed Bean at runtime in
>>  CDI. but how to process Interceptor.
>> 
>>  1. I want to use custom Interceptor(esp extended from the Interceptor
>>  and provides some different behavior) instead of the one shipped by some
>>  framework/tools at runtime ?
>> 
>>  2. How to disable an interceptor at runtime for one ManagedBean(like
>>  Seam 2 bypass annotation), and disable it globally?
>> 
>> 
>>  Hantsy
>> 
>

Reply via email to