[cdi-dev] [JBoss JIRA] (CDI-45) Optional Injection Points

Martin Kouba (JIRA) issues at jboss.org
Thu Oct 13 04:12:01 EDT 2016

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

Martin Kouba commented on CDI-45:

[~meetoblivion] On F2F we decided to add {{isResolvable()}} (is satisfied and not ambiguous), it's already part of the [Weld API|https://github.com/weld/api/blob/2.4/weld/src/main/java/org/jboss/weld/inject/WeldInstance.java#L53]... I suppose this is basically what {{isPresent()}} does. Do you find the name acceptable? Also I quite like {{asOptional()}}.

> 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
>            Priority: Optional
>             Fix For: TBD
> 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

More information about the cdi-dev mailing list