4 Replies Latest reply on Sep 1, 2010 10:24 AM by Pete Muir

    Weld independence vs Guice Independece

    nimo stephan Master

      Can I use Weld in the manner to how I can use Google Guice?

      Google Guice does not need any container or application stack,
      it only needs its libs to work. So I can use Dependency Injection in any Java-Project.

      I know, I can do more with CDI (Weld) than with DI (Guice).

      According to Weld-Documentation:

      Weld provides a complete SPI allowing Java EE containers such as JBoss AS and GlassFish to use Weld as their
      built-in CDI implementation. Weld also runs in servlet engines like Tomcat and Jetty, or even in a plain Java SE

      So I assume, that I only need the libs of CDI and can make use of it in any environment. Am I right?

      The package javax.inject. is a CDI-Package.

      But what about the javax.enterprise.context.
      These are related to HTTP-Scopes, so what about the CONTEXT Dependency Injection.
      Do I need to implement a CONTEXT of my environment (for example, not a HTTP-JSF-Environment) to make use of the CONTEX Dependency Injection or can I ignore the CONTEXT in such environment, when I only want to make use of DI in the manner of Google Guice?

      Is Weld really 100% portable (without any SPI) as Google Guice is?