[JBoss JIRA] (CDI-114) Allow registration of beans at runtime
by Vincent Massol (JIRA)
[ https://issues.jboss.org/browse/CDI-114?page=com.atlassian.jira.plugin.sy... ]
Vincent Massol commented on CDI-114:
------------------------------------
Hi guys. I was wondering if there was now a recommended way of supporting the main use case I listed above back in 2011, namely:
If you have a CDI application, how can you add support for installing extensions at runtime for this application (for example by adding JARs containing beans to the classloader), and tell the Bean Manager to take into account those news beans?
I suspect this is a common need for apps as they grow (i.e. the ability to dynamically add extensions). As I mentioned back then, we've been supporting this in XWiki for about 10 years now with our custom handmade solution but I hate using custom solutions when there exists standard solutions so I'm always on the lookout for such solutions. I've been wanting to try to use CDI for years now but have dropped it in 2011 because of the lack of a solution.
The only option I've heard so far would be to tell the Bean Manager to "restart" and thus re-run the process of creating/resolving the Bean graph. Is that still the only solution? However, I'm worried that this would take too long for our needs since XWiki has thousands (possibly tens of thousands) of Beans running, coming from hundreds of JAR files. Is this "restart"/"reload" already implemented and optimized so that there's no rescanning of JAR files for example? Does anyone have any experience with this?
Thanks a lot!
> Allow registration of beans at runtime
> --------------------------------------
>
> Key: CDI-114
> URL: https://issues.jboss.org/browse/CDI-114
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Beans
> Affects Versions: 1.0
> Reporter: Vincent Massol
> Fix For: TBD
>
>
> I have use cases where I need to register a bean dynamically at runtime (see the forum reference link for a detailed description of the use case).
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years, 10 months
[JBoss JIRA] (CDI-684) Does portable extension should support static observer method
by Antoine Sabot-Durand (JIRA)
Antoine Sabot-Durand created CDI-684:
----------------------------------------
Summary: Does portable extension should support static observer method
Key: CDI-684
URL: https://issues.jboss.org/browse/CDI-684
Project: CDI Specification Issues
Issue Type: Feature Request
Components: Portable Extensions
Reporter: Antoine Sabot-Durand
Error reported in WELD-2331 brings the question of clarification of this point.
Should we forbid usage of static observer in extension class or not ?
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years, 10 months
[JBoss JIRA] (CDI-683) BeanConfigurator#produceWith(Function) does not allow access to InjectionPoint
by Laird Nelson (JIRA)
Laird Nelson created CDI-683:
--------------------------------
Summary: BeanConfigurator#produceWith(Function) does not allow access to InjectionPoint
Key: CDI-683
URL: https://issues.jboss.org/browse/CDI-683
Project: CDI Specification Issues
Issue Type: Bug
Components: Beans
Affects Versions: 2.0 .Final
Reporter: Laird Nelson
The {{BeanConfigurator#produceWith(Function)}} method is intended to simulate a producer method, and is quite convenient.
The {{Function}} that it takes accepts one parameter which is of type {{Instance<Object>}}. This is supposed to allow "faking" parameter injection in a producer method.
One of the parameters that you commonly want in a producer method is the {{InjectionPoint}} for which the return value of the producer method is destined.
If you try to "get" this {{InjectionPoint}} like this:
{code}
final Instance<InjectionPoint> injectionPointInstance = instance.select(InjectionPoint.class);
final InjectionPoint injectionPoint = injectionPointInstance.get();
{code}
...the {{InjectionPoint}} returned is _not_ the one you want, but instead a strange {{InjectionPoint}} that seems to represent something in the {{Instance}} class itself.
The [{{InjectionPoint}} javadocs|http://docs.jboss.org/cdi/api/2.0.Beta1/javax/enterprise/inject/...] say this about the matter:
bq. If the injection point is a dynamically selected reference obtained [sic] then the metadata obtain [sic] reflects the injection point of the Instance, with the required type and any additional required qualifers [sic] defined by Instance.select().
I observe that Weld's behavior in this case matches the javadocs (if I'm understanding them right), but surely I should be able to get the {{InjectionPoint}} that is being serviced by my simulated producer method.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years, 10 months