[cdi-dev] [JBoss JIRA] (CDI-164) Decorating built in beans

Jozef Hartinger (JIRA) jira-events at lists.jboss.org
Thu Oct 11 05:38:03 EDT 2012

     [ https://issues.jboss.org/browse/CDI-164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jozef Hartinger reopened CDI-164:

Multiple reasons for reopening:

h3. Bean Manager
The spec says: Any decorators associated with BeanManager will not be applied.

It is not clear whether this means that decorators are not applied to BeanManager objects injected into Extensions during bootstrap only or whether it means that injected BeanManager objects are never ever decorated.

h3. The extension problem

For each extension there is a bean that allows the extension to be injected into other beans. Should the injected extension support decoration? We can only support this at runtime (no decorators would be applied to extension instances at bootstrap). If we decide to support decoration of injected extension we should think about whether extension instances obtained via BeanManager.getExtension() should support decoration or not.

h3. Consistency

The spec says: "Decorators may be associated with any managed bean that is not itself an interceptor or decorator, with any EJB session bean or with any *built-in* bean."

The spec currently defines a set of container-provided beans out of which a subset is referred to as "built-in" beans. For example, the injected InjectionPoint is not explicitly labeled as "built-in bean". The same applies for injected Bean, Interceptor, Decorator (5.5.8), Validator, ValidatorFactory, ConstraintValidator and extension beans.

We should either say that decorators may be associated with any container-provided bean or we should explicitly label all the container-provided beans as "built-in".

h3. Passivation

Most of the built-in beans are passivation capable dependencies. We should required decorators of built-in beans to be passivation capable. Otherwise the container cannot store a decorator's state when it passivates e.g. an Event instance.
> Decorating built in beans
> -------------------------
>                 Key: CDI-164
>                 URL: https://issues.jboss.org/browse/CDI-164
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Decorators
>    Affects Versions: 1.0
>            Reporter: Jozef Hartinger
>            Assignee: Pete Muir
>             Fix For: 1.1.PRD
> In CDI 1.0, decorators may only be applied to managed and session beans. Decorating built-in beans would make CDI extensions more powerful. 
> One of the possible usecases is represented by decorating the Event bean https://gist.github.com/1223042
> This would allow extensions to implement for example:
> * event queuing (Forge)
> * bidirectional mapping to another event technology without introducing infinite loops (Seam JMS)

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

More information about the cdi-dev mailing list