[cdi-dev] [JBoss JIRA] (CDI-45) Optional Injection Points
Renat Valeev (JIRA)
issues at jboss.org
Mon Sep 1 15:31:01 EDT 2014
[ https://issues.jboss.org/browse/CDI-45?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12997575#comment-12997575 ]
Renat Valeev commented on CDI-45:
---------------------------------
I think there could be an interface between Provider<T> and Instance<T>, which will have method isUnsatisfied(). So that way backward compatibility will be preserved.
The question is not only of how we declare, but also if the dependecy is ambiguous, should resolution fail for "optional" dependecy?
> Optional Injection Points
> -------------------------
>
> Key: CDI-45
> URL: https://issues.jboss.org/browse/CDI-45
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Resolution
> Affects Versions: 1.0
> Reporter: Stuart Douglas
> Fix For: 2.0 (discussion)
>
>
> There are occoasions where it may be useful for some injection points to be optional, e.g.
> @Inject
> @Optional
> MyBean bean;
> This would behave the same as a normal injection point, however it will not cause the deployment to fail if it is not satisified.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
More information about the cdi-dev
mailing list