1 Reply Latest reply on Sep 14, 2015 3:02 AM by Martin Kouba

    Registering a Bean dynamiclly

    Asaf Ben Natan Newbie


      i came across this issue , i have a system that loads jars dynamically (on run-time),

      once a jar appears on a specified folder i load a class which implements a pre-defined interface using classLoader,

      i want to enable these jars to use injection services from the core.

      i have tried using InjectionTarget and all is fine taking account simple situations (injecting already known beans etc..)but looking at a bit more complex situation :

      Jar contains:



      and A has this field :


      B b;


      obviously when injecting A with intectionTarget B is not registered (or even loaded) so InjectionTarget creation fails,

      is there any way loading a whole jar with all dependencies together ?

      looking at the docs i have seen the Extension interface (not sure if it even solves the issue )but the problem is that the implementing interface should be listed in some text file - thus preventing the core to be totally dynamic

      (obviously a crude option here is to write that file and issue a server restart somehow but i would like to avoid that)



      using wildfly 8.2 with built-in weld version