1 Reply Latest reply on Jul 4, 2013 4:53 AM by mkouba

    How to get Deployment interface implementation in Weld

    rmemoria

      I'm using Weld in JBOSS 7.1 and I have a web app that loads jars at runtime (like in a plugin system).

       

      It'd make my life quite easier if Weld could recognize all beans inside my jar (these jars are not in the WEB-INF/lib, but in the file system and loading is done in runtime).

       

      I see there is an interface available in Weld called Deployment, where it comes with a method to load beans in an archive.

       

      My Question - Does anybody knows how to get an instance of this Deployment interface? Ideally inside beforeBeanDiscovery event.

       

      Thanks,

      Ricardo

        • 1. Re: How to get Deployment interface implementation in Weld
          mkouba

          Hi Ricardo,

           

          I don't think this would help you. CDI does not support adding beans dynamically - the lifecycle is given (1. Initialization [bean discovery, loading extensions, etc.], 2. Runtime ,3. Shutdown). I think the only way is to use producers and handle the plugin system separately. Also it's not a good idea to depend on Weld API, it makes your app non-portable...