[infinispan-issues] [JBoss JIRA] (ISPN-7351) Support @Named in CDI extension

Sebastian Łaskawiec (JIRA) issues at jboss.org
Tue Jan 24 06:05:00 EST 2017


    [ https://issues.jboss.org/browse/ISPN-7351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13352618#comment-13352618 ] 

Sebastian Łaskawiec commented on ISPN-7351:
-------------------------------------------

[~Seto] I checked the {{@Named}} annotation and the implementation seems to work fine with it (see the [PR|https://github.com/infinispan/infinispan/pull/4793]).

However, let me clarify a couple of things:

* As the [Javadoc states|http://docs.oracle.com/javaee/6/api/javax/inject/Named.html], {{@Named}} is a String-based *qualifier*. This means that it can be used as a replacement for {{@Qualifier}} annotations.
* Since you might want to use {{Configuration}} as a standard, CDI managed bean, we need to use an additional annotation ({{ConfigureCache}}), to tell the CDI extension, that we want to use given {{Configuration}} instance for creating caches dynamically.

Having all of the above in mind, a proper configuration should look like this:
{code}
@Named("large") //A String-based *qualifier*
@ConfigureCache("large") //We ask CDI to use this bean for configuring Cache Manager
@Produces
public Configuration largeConfiguration = new ConfigurationBuilder().memory().size(3).build();
...
@Inject
@Named("large") //Those names need to match
private AdvancedCache<?, ?> largeCache;
{code}

Also, please make sure that you are using the latest Infinispan 9. We introduced a lot of improvements for CDI in this release.

> Support @Named in CDI extension
> -------------------------------
>
>                 Key: ISPN-7351
>                 URL: https://issues.jboss.org/browse/ISPN-7351
>             Project: Infinispan
>          Issue Type: Feature Request
>          Components: CDI Integration
>            Reporter: Sebastian Łaskawiec
>            Assignee: Sebastian Łaskawiec
>
> Currently our users have to create lots and lots of {{@Qualifier}} type of annotations. It would be desirable to support {{@Named("driver")}} type of annotations.
> Useful links:
> * {{@Named}} Javadoc: http://docs.oracle.com/javaee/6/api/javax/inject/Named.html



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)



More information about the infinispan-issues mailing list