[jbosstools-issues] [JBoss JIRA] Updated: (JBIDE-9428) Support injection of Provider<X> beans

Viacheslav Kabanovich (JIRA) jira-events at lists.jboss.org
Fri Jul 29 11:56:23 EDT 2011


     [ https://issues.jboss.org/browse/JBIDE-9428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Viacheslav Kabanovich updated JBIDE-9428:
-----------------------------------------

    Description: 
5.6.2. The built-in Instance
The container must provide a built-in bean with:
• Instance<X> and Provider<X> for every legal bean type X in its set of bean types,
• every qualifier type in its set of qualifier types,
• scope @Dependent,
• no bean EL name, and
• an implementation provided automatically by the container.

Since Instance extends Provider, CDI implementations are likely to just implement Instance interface, which automatically supports injections of Provider<X> as well as that of Instance<X>. So, in practice, there is no difference between these two injections, but formally, Provider interface misses methods narrowing the set of eligible beans and methods for checking if that set is ambiguous or unsatisfied; the only method get() throws RuntimeException in such cases, so that it is logical to perform validation of Provider<X> injection in the same way as X injection.

EXECUTE: Create in a CDI project bean class Bean and injection point 
{code}
@Inject Provider<Bean> b;
{code}
ASSERT: Injection point is not marked as unsatisfied.
ASSERT: Open-on for @Inject has an option that opens Bean class.

  was:
5.6.2. The built-in Instance
The container must provide a built-in bean with:
• Instance<X> and Provider<X> for every legal bean type X in its set of bean types,
• every qualifier type in its set of qualifier types,
• scope @Dependent,
• no bean EL name, and
• an implementation provided automatically by the container.

Since Instance extends Provider, CDI implementations are likely to just implement Instance interface, which automatically supports injections of Provider<X> as well as that of Instance<X>. So, in practice, there is no difference between these two injections, but formally, Provider interface misses methods narrowing the set of eligible beans and methods for checking if that set is ambiguous or unsatisfied; the only method get() throws RuntimeException in such cases, so that it is logical to perform validation of Provider<X> injection in the same way as X injection.



> Support injection of Provider<X> beans
> --------------------------------------
>
>                 Key: JBIDE-9428
>                 URL: https://issues.jboss.org/browse/JBIDE-9428
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: cdi
>    Affects Versions: 3.3.0.M2
>            Reporter: Viacheslav Kabanovich
>            Assignee: Viacheslav Kabanovich
>             Fix For: 3.3.0.M3
>
>
> 5.6.2. The built-in Instance
> The container must provide a built-in bean with:
> • Instance<X> and Provider<X> for every legal bean type X in its set of bean types,
> • every qualifier type in its set of qualifier types,
> • scope @Dependent,
> • no bean EL name, and
> • an implementation provided automatically by the container.
> Since Instance extends Provider, CDI implementations are likely to just implement Instance interface, which automatically supports injections of Provider<X> as well as that of Instance<X>. So, in practice, there is no difference between these two injections, but formally, Provider interface misses methods narrowing the set of eligible beans and methods for checking if that set is ambiguous or unsatisfied; the only method get() throws RuntimeException in such cases, so that it is logical to perform validation of Provider<X> injection in the same way as X injection.
> EXECUTE: Create in a CDI project bean class Bean and injection point 
> {code}
> @Inject Provider<Bean> b;
> {code}
> ASSERT: Injection point is not marked as unsatisfied.
> ASSERT: Open-on for @Inject has an option that opens Bean class.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the jbosstools-issues mailing list