4 Replies Latest reply on Sep 6, 2013 9:24 AM by Jozef Hartinger

    About multi bean managers interactive

    Tang Yong Newbie

      Hi,

       

      I have a question as following:

       

      I am implementing some dynamic Java EE feature combined with OSGi,

       

      I have a wab(web bundle) called "wab1" using JSF 2 and CDI, and while deploying the wab, a bean manager called bm1 is created.

       

      Then, I plan to deploy another wab called "wab2" which also uses JSF 2 and CDI, and among wab2, there is a CDI Bean as following,

       

      @Named

      @RequestScoped

      public class AboutBean {

          private String message;

       

          /**

           * @return the message

           */

          public String getMessage() {

              return message;

          }

      ...

       

      While deploying wab2, I wish AboutBean can be also registered into bm1 from wab1. Common way should be impossible(Maybe I am wrong). So,

      I design a CDI extension and add some annotation into AboutBean to notify CDI extension.

       

      @Named

      @RequestScoped

      @DynamicBean(ContextPath="wabsample")    ---> My imaginary way

      public class AboutBean {

          private String message;

       

          /**

           * @return the message

           */

          public String getMessage() {

              return message;

          }

      ...

       

      ContextPath="wabsample" is wab1's context path in order that CDI extension can find bm1 by the property.


      So, here's critical point is that CDI extension can find bm1 by some way, my question is that is there any way to find bm1?


      Any other idea is good, thanks!


      Tang