Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-1559

Proposal for dependency injection and lifecycle method handling

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.0-SNAPSHOT, 1.2.1-SNAPSHOT
    • 1.2.0-SNAPSHOT, 1.2.0
    • General
    • None

    Description

      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.

      Attachments

        1. MYFACES-1559-3.patch
          31 kB
          David Jencks
        2. MYFACES-1559-2.patch
          18 kB
          David Jencks
        3. MYFACES-1559-1.patch
          14 kB
          David Jencks

        Issue Links

          Activity

            People

              bommel Bernd Bohmann
              djencks David Jencks
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: