[
https://issues.jboss.org/browse/CDI-469?page=com.atlassian.jira.plugin.sy...
]
Jozef Hartinger commented on CDI-469:
-------------------------------------
My understanding of the usecase is the following:
Suppose we have a *binding* qualifier:
{code:JAVA}
@Qualifier
...
public @interface Converter {
String value();
}
{code}
and we want to produce several distinct beans e.g.:
@ApplicationScoped @Converter("foo") Function<?,?>
@ApplicationScoped @Converter("bar") Function<?,?>
We have to write a separate producer method for each, specifying the binding qualifier. We
cannot write one producer to produce both foo and bar. We do not however want to duplicate
the producer method code. Instead, we would like to direct creation to the single generic
method that, should it know the value of @Converter annotation, is capable of creating the
bean instance.
Something like binding at the injection point side but non-binding at the producer side.
Allow nonbinding producer methods to have scopes
------------------------------------------------
Key: CDI-469
URL:
https://issues.jboss.org/browse/CDI-469
Project: CDI Specification Issues
Issue Type: Feature Request
Components: Beans, Contexts
Affects Versions: 1.2.Final
Reporter: John Ament
Currently, you cannot have a nonbinding producer method, e.g. one where the annotation is
read at runtime, with a scope. This means that repeated injections always happen. It
would be better if you could scope the nonbinding producer methods, so that the results
were bound, e.g. to a request scope, so that look ups can be done once.
The current way to avoid this is to use a holder object with the proper scope.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)