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

Romain Manni-Bucau (JIRA) issues at jboss.org
Mon Feb 20 05:21:00 EST 2017


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

Romain Manni-Bucau commented on CDI-114:
----------------------------------------

producers are Bean so you can reuse CDI semantic (qualifiers etc) but not interceptors (until you use the factory cdi 2.0 introduces which is another part of the DIY) and other parts like post constuct etc as well (Unmanaged or equivalent). So whatever you do producers are for 3rd party integration and you keep all the work in this 3rd party. Until you add scanning and use default managed Beans you will not benefit of all CDI but just a subset like contexts, light lifecycle (produces/disposes), integration with other beans etc...

Also it is unclear to me how CDI would fit your need since you have components but generally in extensions only and a set of selectable component depending a key where CDI will not help much (you still need a custom lookup aligned on your design so CDI or not is equivalent there which the Bean is managed by CDI which is done with an inherited BeanManager solution). Also note adding at runtime Beans still requires a classloader (CDI is not doing  anything there) so this solution is actually low cost for you anyway.

> 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