[
https://issues.jboss.org/browse/ISPN-7351?page=com.atlassian.jira.plugin....
]
Seto Kaiba commented on ISPN-7351:
----------------------------------
The injection is working. The problem is not about @Named.
But the problem is
org.infinispan.cdi.DefaultEmbeddedCacheManagerProducer.getDefaultEmbeddedCacheManager(DefaultEmbeddedCacheManagerProducer.java:38)
will inject the @Default Configuration. @Named is not treated as normal @Qualifier. The
built-in @Default will be added.
Then ambiguous dependencies will occur.
Anyway, there's a simple workaround below.
Define a normal Qualifier called NamedCache.
{code:java}
@Qualifier
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface NamedCache {
}
{code}
And then use it together with @Named to annotate the Configuration producer.
{code:java}
@ConfigureCache("named1")
@NamedCache
@Named("named1")
@Produces
public Configuration named1CacheConfig() {
return distributeConfig(defaultConfig()).build();
}
{code}
And then inject cache using @Named only.
{code:java}
@Inject
@Named("named1")
Cache<String,String> named1;
{code}
Still, ask for a multiple @ConfigureCache support.
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)