[jboss-user] [JBoss Cache Users] - Injection into the custom interceptor
SKabashnyuk
do-not-reply at jboss.com
Mon Nov 16 05:05:34 EST 2009
I have a question about using custom interceptors.
Is it possible to inject object into the custom interceptor using
@Inject annotation?
My interceptor code look like this:
| public class MyInterceptor extends CommandInterceptor
| {
|
| ......
| @Inject
| public void inject(InterceptorParameter interceptorParameter)
| {
| .....
| }
| ....
| }
InterceptorParameter class defined as :
@NonVolatile
| public class InterceptorParameter
| {
| ...
| }
Interceptor configured from xml:
<customInterceptors>
| <interceptor after="org.jboss.cache.interceptors.CacheStoreInterceptor"
| class="org.exoplatform.services.jcr.impl.storage.jbosscache.MyInterceptor" >
| </interceptor>
| </customInterceptors>
Interceptor parameter registered through CacheSPI.
Cache<Serializable, Object> cache =
| factory.createCache(InjectionTest.class.getResourceAsStream("test-custom-interceptor.xml"),
| false);
|
| InterceptorParameter interceptorParameter = new InterceptorParameter();
| ((CacheSPI<Serializable,
| Object>)cache).getComponentRegistry().registerComponent(interceptorParameter,InterceptorParameter.class);
|
| cache.create();
| cache.start();
|
Thanks.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4265807#4265807
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4265807
More information about the jboss-user
mailing list