Proposal for dependency injection and lifecycle method handling
---------------------------------------------------------------

                 Key: MYFACES-1559
                 URL: https://issues.apache.org/jira/browse/MYFACES-1559
             Project: MyFaces Core
          Issue Type: New Feature
          Components: General
    Affects Versions: 1.2.0-SNAPSHOT
            Reporter: David Jencks
             Fix For: 1.2.0-SNAPSHOT


I'm opening this jira as a convenient place to put code samples in support of 
discussion on the dev list

Based on my experience implementing dependency injection and lifecyle methods 
in the geronimo app client container and the geronimo-jetty integration, and 
inspired by the openejb3 code for this purpose, I'd like to propose that 
MyFaces consider using an interface similar to this for object creation and 
shutdown:

public interface LifecycleProvider {

    /**
     * Create an object of the class with the supplied name, inject 
dependencies as appropriate,
     * and call a postContruct method as appropriate.
     *
     * @param className name of the class of the desired object
     * @return a fully constructed, dependency-injected, and initialized object.
     */
    Object newInstance(String className);

    /**
     * Take whatever steps are needed to shut down the object, including 
calling a preDestroy method.
     *
     * @param o object to shut down.
     */
    void destroyInstance(Object o);
}

It's easy to write an adapter between this and the AnnotationProcessor 
interface currently implemented.


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

Reply via email to