3 Replies Latest reply on Dec 18, 2006 1:17 PM by Carlo de Wolf

    Injection Framework

    Carlo de Wolf Master

      With the injection framework it should be possible to easily inject
      values into beans. Note that the injection framework doesn't specify
      properties of a bean in the same way as JavaBeans does. Any field or
      setter method can constitute a property.

      The injection works in two phases:
      1. Setup of the environment
      2. Injection of objects

      The environment could be setup in JNDI, but this is not required
      by the injection framework. For JNDI setup an implementation is
      provided.

      Injection of objects can be specified programatically. For
      annotation based injection an implementation is provided.

      It's not IoC or MC injection, because it doesn't take into
      account dependencies.

      Although the injection framework contains annotation processors JSR-269
      is left out of scope.

        • 1. Re: Injection Framework
          Carlo de Wolf Master

          I'm also putting AOP beyond scope for 3 reasons:

          1. Can't get an unit test to work in surefire (/maven2)
          2. Both EJB3 container and client launcher don't need the extra functionality
          3. Can't think of a proper bind-cut without recurssion into the injection framework

          It should be easy to create a separate module which does injection with
          AOP.

          We'll lose the possibility to have a POJO injection classloader.

          • 2. Re: Injection Framework
            Scott Stark Master

            Is there a question here or this is just the plan? As an integration piece, I would think we want an mc dependency injection handler so that an injection reference does result in a property dependency relationship.

            • 3. Re: Injection Framework
              Carlo de Wolf Master

              Correct, the MC injection & dependencies are done in the setup phase.
              So for example if SessionBean1 wants SessionBean2 injected then SessionBean1 container is registered as being dependant on SessionBean2 container, which will start and put SessionBean2 in JNDI... MC starts SessionBean1 container, put SessionBean1 in JNDI, setup JNDI env (java:comp/env/SessionBean2 -> java:global.ear/SessionBean2/local) and then start the injection phase (java:comp/env/SessionBean2 -> SessionBean1.bean2Interface).
              To summarize scope: injection framework does (EJB3) bean injection, while the container (EJB2 + 3) work with MC for dependency injection.