[cdi-dev] [JBoss JIRA] (CDI-114) Allow registration of beans at runtime

Vincent Massol (JIRA) issues at jboss.org
Mon Feb 20 12:31:00 EST 2017


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

Vincent Massol commented on CDI-114:
------------------------------------

{quote} since xwiki is dynamic it needs to control what was injected before to be able to update which is not in Spring/Guice/CDI as basic features (always done through proxies and as an internal bean impl).{quote}

In XWiki we do lazy instantiation of components, i.e. we instantiate them when they are required (ie. when the ComponentManager.getInstance() is called or when a component needs to be injected in another component). However we do not control what was injected before. FTR XWiki only supports field injection. Thus if you register a new implementation of a Component role at runtime, all existing components that have been instantiated already are not modified. However when a component needs to have an aways up to date @Inject(ed) field, we use a Provider<> and the code using it calls get() on it to return the latest registered component instance from the Component Manager.

BTW thanks for your replies! :)

> 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)


More information about the cdi-dev mailing list