Class GuiceBridge

java.lang.Object
org.jvnet.hk2.guice.bridge.api.GuiceBridge
Direct Known Subclasses:
GuiceBridgeImpl

public abstract class GuiceBridge extends Object
This class can be used to initialize a ServiceLocator for use with the Guice/HK2 Bridge
Author:
jwells
  • Constructor Details

    • GuiceBridge

      public GuiceBridge()
  • Method Details

    • allowJakartaInject

      public static void allowJakartaInject()
      Configure Guice to allow for Jakarta annotations. This function must be called before any annotation bindings are created.
    • getGuiceBridge

      public static GuiceBridge getGuiceBridge()
    • initializeGuiceBridge

      public abstract void initializeGuiceBridge(org.glassfish.hk2.api.ServiceLocator locator) throws org.glassfish.hk2.api.MultiException
      This method will initialize the given service locator for use with the Guice/HK2 bridge. It adds into the service locator an implementation of GuiceIntoHK2Bridge and also the custom scope needed for Guice services. This method is idempotent, in that if these services have already been added to the service locator they will not be added again
      Parameters:
      locator - A non-null locator to use with the Guice/HK2 bridge
      Throws:
      org.glassfish.hk2.api.MultiException - On failure