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

Romain Manni-Bucau (JIRA) issues at jboss.org
Mon Sep 1 15:24:00 EDT 2014

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

Romain Manni-Bucau commented on CDI-45:

Well Instance almost matches this need. Only known issue it has is the fact it doesn't only have isSatisfied(), get() methods so resolution is almost everytimes done lazily which is/can be slow compared to normal injection. Having SingletonInstance with only these methods (and Instance inheriting from it) could solve it but not sure this change can be introduced.

> 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

More information about the cdi-dev mailing list