[cdi-dev] [JBoss JIRA] (CDI-585) Add the possibility to remove a bean in AfterBeanDiscovery event

Mark Struberg (JIRA) issues at jboss.org
Thu Feb 18 09:57:00 EST 2016


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

Mark Struberg commented on CDI-585:
-----------------------------------

I like this idea, BUT we _really_ have to be careful with all the 'disabled beans' stuff. It is again a chicken-egg problem. If you remove a @Specializes bean for example, then you king of change the whole constellation...

> Add the possibility to remove a bean in AfterBeanDiscovery event
> ----------------------------------------------------------------
>
>                 Key: CDI-585
>                 URL: https://issues.jboss.org/browse/CDI-585
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Portable Extensions
>    Affects Versions: 1.2.Final, 2.0-EDR1
>            Reporter: Antoine Sabot-Durand
>
> Right now, the last occasion to "veto" a bean is in {{ProcessBeanAttributes}}, but we sometimes need to have all the bean discovered to decide if a given Bean should be present or not.
> Sometimes we also need a way to decide lately for some bean properties, so it would be useful to remove the original bean and provide a custom one wrapping it in replacement.
> Adding the {{removeBean(Bean<?> bean)}} to {{AfterBeanDiscoveryEvent}} would be helpful to perform easily these use case.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the cdi-dev mailing list