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

Vincent Massol (JIRA) issues at jboss.org
Tue Feb 21 07:22:01 EST 2017

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

Vincent Massol commented on CDI-114:

{quote}Hmm, does it means xwiki is leaking cause previously injected values can be unregistered ("remove extension")?{quote}

Actually I don't know how we would behave if you remove at runtime a component that's been previously injected in another component. In theory yes there should be a problem.In practice in 12 years of XWiki I've never seen this happen.

{quote}Or did you mean you never inject the component by type but always Provider<X> everywhere? {quote}

No we don't do that systematically, although we recommend it. It's done mostly at places where it's important to be able to use the latest registered component for a given role.

{quote}If so you also do lazy validation which means you accept to start a not functional app cause of a missing component - CDI prevents it. Is that right?{quote}

Yes we do allow this.


> 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

More information about the cdi-dev mailing list