[cdi-dev] [JBoss JIRA] Commented: (CDI-14) Add instance() method to BeanManager
Arne Limburg (JIRA)
jira-events at lists.jboss.org
Wed May 11 17:07:18 EDT 2011
[ https://issues.jboss.org/browse/CDI-14?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12601501#comment-12601501 ]
Arne Limburg commented on CDI-14:
It must not be JNDI. We can get the BeanManager from elsewhere (a ThreadLocal or a static singleton from somewhere).
My point was the same as Petes: The BeanManager is for extension developers and they can get it injected, so no need to access it from elsewhere.
Application developers (or users of CDI like Pete called them) should not need to obtain a BeanManager. The only thing they need is to get a contextual reference from within an unmanaged object (like a JPA EntityListener or a Struts Action or other unusual cases). And the ObjectInstance would be great for this. And additionally it provides the "give me all beans of a certain type" access.
Another option would be to provide a SPI to inject into unmanaged instances. Something like BeanManager#inject(Object). But again this needs not to be the BeanManager, because it will be used by application developers and the BeanManager is used by Extension developers.
> 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