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

Matej Novotny (JIRA) issues at jboss.org
Wed Oct 12 03:19:01 EDT 2016


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

Matej Novotny commented on CDI-45:
----------------------------------

-1 for {{Optional}} built-in bean, the limitations of that approach and the confusion caused (Optional vs Instance) are just not worth the few methods.
Adding all methods onto {{Instance}} just feels dirty; -10.

Personally I think explicitly supporting {{Optional}} isn't really worth it. But if we want to go that way anyway, I'd be +1 for adding {{Instance.getOptional}}.

> 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
(v6.4.11#64026)


More information about the cdi-dev mailing list