[JBoss JIRA] Commented: (CDI-14) Add instance() method to BeanManager
by Pete Muir (JIRA)
[ https://issues.jboss.org/browse/CDI-14?page=com.atlassian.jira.plugin.sys... ]
Pete Muir commented on CDI-14:
------------------------------
Yes as previously commented I was saying simply that if we made it available outside of a managed object it would be via the same mechanisms that we use for all other artifacts from CDI you can look up like this (i.e. currently BM). I'm not in love with the idea that we expose Instance directly, as I think requiring extension authors to write:
{code}
Foo foo = beanManager.dynamic().select(Foo.class).get();
{code}
(or whatever else this method get's called) is not that onerous given this is extension authors only.
With hindsight I would have preferred to split up BeanManager more than was done in 1.0 but we can't got back and do that now!
> 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
14 years, 8 months
[JBoss JIRA] Commented: (CDI-14) Add instance() method to BeanManager
by Mark Struberg (JIRA)
[ https://issues.jboss.org/browse/CDI-14?page=com.atlassian.jira.plugin.sys... ]
Mark Struberg commented on CDI-14:
----------------------------------
But then you hit the scenario that you like to fire an event from a JPA EntityListener (had this recently) and you need the whole BeanManager again ;)
But I'm completely d'accord with you that using the BeanManager or any other SPI outside an Extension should only be a really exceptional case!
> 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
14 years, 8 months
[JBoss JIRA] Commented: (CDI-14) Add instance() method to BeanManager
by Arne Limburg (JIRA)
[ https://issues.jboss.org/browse/CDI-14?page=com.atlassian.jira.plugin.sys... ]
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
14 years, 8 months
[JBoss JIRA] Commented: (CDI-14) Add instance() method to BeanManager
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/CDI-14?page=com.atlassian.jira.plugin.sys... ]
George Gastaldi commented on CDI-14:
------------------------------------
Mark, that´s why the java:comp/env namespace exists from. In fact, each app server has it´s own descriptor in order to map java:comp/env references to external (appserver) bindings. But that´s another discussion.
Maybe Pete´s previous statement could lead to a right direction. Having a facade API for BeanManager could do the job.
> 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
14 years, 8 months
[JBoss JIRA] Commented: (CDI-14) Add instance() method to BeanManager
by Mark Struberg (JIRA)
[ https://issues.jboss.org/browse/CDI-14?page=com.atlassian.jira.plugin.sys... ]
Mark Struberg commented on CDI-14:
----------------------------------
I'd keep it in the BeanManager. Having to code 1 static singleton lookup is ugly enough.
Btw, please NOT JNDI again. JNDI really sucks! The JNDI spec is a splitter bomb cross over the whole JCP. You will find 20++ JSRs which define name spaces + behaviour, etc. Parts got cleaned up in EE6 (or was it 5?), but it's still broken and non-portable across AppServers to big degrees.
An example: try to register a Seam2/Hibernate datasource which works in different EE Servers without changing the JNDI name... This is just broken...
Also: there are a lot environments which either not have a JNDI environment at all, or it's readonly.
Just my 0.02 ...
> 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
14 years, 8 months
[JBoss JIRA] Commented: (CDI-14) Add instance() method to BeanManager
by Richard Hightower (JIRA)
[ https://issues.jboss.org/browse/CDI-14?page=com.atlassian.jira.plugin.sys... ]
Richard Hightower commented on CDI-14:
--------------------------------------
RE: a) you were looking in the wrong place
Wouldn't be the first time. :)
RE: b) the spec did a very very bad job of showing you the right place to look (actually it showed you the wrong place!)
I think the issue is that the BeanManager is the "thing" you look up in JNDI. The thing you look up in JNDI is usually the interface that end users deal with not an internal API. That said I looked at it with a "Spring perspective" because that is what I have been dealing with for the past 9 years or so.
> 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
14 years, 8 months