[ 
https://issues.apache.org/jira/browse/MYFACES-3786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13794127#comment-13794127
 ] 

Leonardo Uribe commented on MYFACES-3786:
-----------------------------------------

@Gerhard unfortunately the change you did will not work, because it assume all 
injected beans has application lifespan. Theorically that's true for now but 
will it be in the future? It is more, LifecycleProvider inject all JSF managed 
beans, so we can't rely on that fact. The problem is if exists a problem with 
dependant beans with like you said, we'll be forced in the future to change 
InjectionProvider interface again, and that's something we should avoid.

The only thing that will work is pass the creational context after the inject, 
but without reference the object itself or the implementation. We could change 
InjectionProvider from this:

public void inject(Object instance) throws InjectionProviderException
public void postConstruct(Object instance) throws InjectionProviderException
public void preDestroy(Object instance) throws InjectionProviderException

To this:

public Object inject(Object instance) throws InjectionProviderException
public void postConstruct(Object instance, Object context) throws 
InjectionProviderException
public void preDestroy(Object instance, Object context) throws 
InjectionProviderException

And delegate the resposibility to hold the context over JSF artifact lifespan 
to JSF in the places we require to do so. Do you agree with this proposal?

@Dora : the final version of the patch was already committed into trunk, 
including all cases. Again, converter/validator case is handled in 
MYFACES-3937, which was already committed too as an extension, disabled by 
default. 


> Web Container injection support should be provided for additional lifecycle 
> artifacts (not just managed beans)
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-3786
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3786
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-344
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>             Fix For: 2.2.0
>
>         Attachments: cdiELresolverWeb.zip, cdiELResolver.zip, 
> cdiPartialViewContext.war, cdiPartialViewContext.zip, cdi.patch, 
> cdiphaselistener1.patch, cdiphaselistener2.patch, cdirevised.patch, 
> cdiValidatorSource.zip, 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
(v6.1#6144)

Reply via email to