[cdi-dev] [JBoss JIRA] (CDI-682) Allow unregistration of CDI beans at run time, through API

Laird Nelson (JIRA) issues at jboss.org
Wed Feb 1 11:55:00 EST 2017


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

Laird Nelson commented on CDI-682:
----------------------------------

If you really need dynamic registration and are relying on CDI primarily for dependency injection and not much else, your philosophy of how things should work is better suited to something like [HK2|https://hk2.java.net/2.5.0-b32/].  I find that each toolkit has its uses.  IMHO one of CDI's strengths is its static nature.

> Allow unregistration of CDI beans at run time, through API
> ----------------------------------------------------------
>
>                 Key: CDI-682
>                 URL: https://issues.jboss.org/browse/CDI-682
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Beans, Events, Interceptors
>    Affects Versions: 1.2.Final
>            Reporter: Samba Kolusu
>
> much like the ability to register beans at runtime through API (https://issues.jboss.org/browse/CDI-114)
> also provide API 
> BeanManager::unregister("beanName"), or BeanManager::unregister(XYZBean.class) 
> to unregister beans at runtime, and corresponding events (BeforeUnregisteringBean, AfterUnregisteringBean, etc) so that interested listeners can take appropriate actions in the event of a bean getting removed from CDI context.
> these two together will help build pluggable web applications much like OSGI modules. right now, installing new beans or removing exiting beans requires restart of CDI container, if not web application. with the addition of these two features [registering beans at run time, through BeanManager::register(XYZBean.class) ], and unregistering beans at runtime [BeanManager::unregister(XYZBean.class) ]  true modularity comes to Java EE world, without the necessity to restart 



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the cdi-dev mailing list