[cdi-dev] [JBoss JIRA] Commented: (CDI-14) Add instance() method to BeanManager

Mark Struberg (JIRA) jira-events at lists.jboss.org
Sat May 7 02:58:18 EDT 2011

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

Mark Struberg commented on CDI-14:

To clarify this a bit:
Currently we need 
* BeanManager#getBeans
* BeanManager#resolve
* BeanManager#getReference

I don't think 
Instance<Object> instance(); 
is enough.

It should be more like
Instance<T> instance(T, Annotation<? extends Qualifier>);

But to be honest: imo we should not make too much functionality available in the BeanManager and bloat our interface if it is easily doable already. This is really only used in situations where you cannot @Inject your Instance object (means in unmanaged instances like a JPA EntityListener or similar). But in those rare cases, it's easily doable already. Maybe we just add an own section to the spec and explain how this 3 methods work together for getting the contextual reference?

> Add instance() method to BeanManager
> ------------------------------------
>                 Key: CDI-14
>                 URL: https://issues.jboss.org/browse/CDI-14
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Resolution
>    Affects Versions: 1.0
>            Reporter: Pete Muir
>             Fix For: 1.1 (Proposed)
> Currently obtaining a contextual reference is quite a complex operation, adding a method like:
> Instance<Object> instance();
> would make it much easier.

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

More information about the cdi-dev mailing list