myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerhard Petracek (JIRA)" <>
Subject [jira] [Commented] (MYFACES-3786) Web Container injection support should be provided for additional lifecycle artifacts (not just managed beans)
Date Tue, 15 Oct 2013 08:03:43 GMT


Gerhard Petracek commented on MYFACES-3786:

trying something only makes sense if you aren't sure about the result.
we know the result already - so trying something with obvious flaws doesn't make a lot of

if you would like to try something, then we can try a #5.
all proper cdi scopes use some kind of entry to bind the instance together with the CreationalContext.
(please remember what you copied from deltaspike (see ContextualInstanceInfo)...)
in those cases the storage is clear - it's the context itself.
here we don't implement a context, but we can just use the same concept since the basic issue
is the same:

public class BeanEntry
    private final Object instance;
    private Map<String, Object> metaData = new HashMap<String, Object>();

    public BeanEntry(Object instance)
        this.instance = instance;

    public Object getInstance()
        return instance;

    public Map<String, Object> getMetaData()
        return metaData;

public abstract class InjectionProvider
    public abstract void inject(BeanEntry entry) throws InjectionProviderException;

    public abstract void postConstruct(BeanEntry entry) throws InjectionProviderException;

    public abstract void preDestroy(BeanEntry entry) throws InjectionProviderException;


also here we have to store the BeanEntry in the target-scope.
it's the only approach for the current need for which you don't have to create a key to find
the meta-data (like the CreationalContext) for a given object. for what we need right now
the impact is smaller than it might sound. there is no change for the jsf-artifacts, you just
create an additional entry for them in a list (instead of a map). during the shutdown you
iterate through the whole list and pass the entries to InjectionProvider#preDestroy.

> Web Container injection support should be provided for additional lifecycle artifacts
(not just managed beans)
> --------------------------------------------------------------------------------------------------------------
>                 Key: MYFACES-3786
>                 URL:
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-344
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>             Fix For: 2.2.0
>         Attachments:,, cdiPartialViewContext.war,, cdi.patch, cdiphaselistener1.patch, cdiphaselistener2.patch, cdirevised.patch,, cdiValidator.war, MYFACES-3786-1.patch, MYFACES-3786-2.patch
>  This issue is all about how to inject beans into jsf artifacts.
> See JSF 2.2 section 5.4.1
> The problem here is in some point we need to give the control to the underlying environment
to inject beans into the artifacts, but we don't know much about how to properly do it, so
we need to try with examples.

This message was sent by Atlassian JIRA

View raw message