myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernhard Huemer (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-1761) Handling PostConstruct annotations - wrong order
Date Fri, 09 Nov 2007 16:14:50 GMT

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

Bernhard Huemer commented on MYFACES-1761:
------------------------------------------

I guess I have to agree that the specification leaves room to interpretation and I understand
your point of view, but I wouldn't go so far as you. In fact I didn't even thought of it as
your intepretation seems rather farfetched to me (sorry ;-)), especially if I'm considering
the specification issue discussion. Ed Burns proposed the following: "1. call any public no
argument managed bean methods annotated with @PostConstruct be called after the object is
instantiated, and after *any* injection is performed, but before the bean is placed into the
scope."

Besides that, I don't understand why you're strongly objecting to changing the interface.
LifecycleProvider.newInstance() remains to be a perfect integration point for injecting serveral
JavaEE components. My proposed patch shows how easy it is to refactor a "typical" implementation
(I know that it has not been a full-fledged JavaEE container, but I think it's actually the
same - just a simple "processAnnotations" method call).

> Handling PostConstruct annotations - wrong order
> ------------------------------------------------
>
>                 Key: MYFACES-1761
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1761
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions:  1.2.0, 1.2.1-SNAPSHOT
>            Reporter: Bernhard Huemer
>             Fix For: 1.2.1-SNAPSHOT
>
>         Attachments: MyFaces-1761.patch, postconstruct-demo.zip
>
>
> The specification states that managed bean methods annotated with @PostConstruct have
to be called after the object is initialized and after dependency injection is performed.
However, MyFaces calls those methods after the bean instance is created but before dependency
injection is performed (for example, see http://www.nabble.com/myfaces-1.2.0-postConstruct-tf4760326.html
). In order to resolve this bug the LifecycleProvider interface has to be changed. Currently
there's only one method responsible for creating/initializing a new bean: newInstance(). This
design choice implicates that there's no possibility to seperate the steps "creating the bean"
and "postconstructing the bean".

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message