Class PropertyBundleLookup

  • All Implemented Interfaces:
    GuiceyBundleLookup

    public class PropertyBundleLookup
    extends java.lang.Object
    implements GuiceyBundleLookup
    Use 'guicey.bundles' system property to lookup bundles. Property value must contain comma-separated list of complete bundle class names. Each bundle in list must have default no-args constructor.

    Example: -Dguicey.bundles=com.foo.MyBundle1,com.foo.MyBundle2.

    Static shortcut method may be used to set property value from code (for example, in unit tests to enable specific debug bundle): PropertyBundleLookup.enableBundles(MyBundle1.class, MyBundle2.class).

    For example, last approach is used in guicey tests to enable HK2DebugBundle to check beans boundaries during tests.

    Since:
    16.01.2016
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BUNDLES_PROPERTY  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void enableBundles​(java.lang.Class<? extends GuiceyBundle>... bundles)
      Sets system property value to provided classes.
      java.util.List<GuiceyBundle> lookup()
      Called before guice injector creation to lookup additional bundles (in dropwizard run phase).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BUNDLES_PROPERTY

        public static final java.lang.String BUNDLES_PROPERTY
        See Also:
        Constant Field Values
    • Constructor Detail

      • PropertyBundleLookup

        public PropertyBundleLookup()
    • Method Detail

      • lookup

        public java.util.List<GuiceyBundle> lookup()
        Description copied from interface: GuiceyBundleLookup
        Called before guice injector creation to lookup additional bundles (in dropwizard run phase).
        Specified by:
        lookup in interface GuiceyBundleLookup
        Returns:
        list of found bundles or empty list
      • enableBundles

        @SafeVarargs
        public static void enableBundles​(java.lang.Class<? extends GuiceyBundle>... bundles)
        Sets system property value to provided classes. Shortcut is useful to set property from code, for example, in unit tests.
        Parameters:
        bundles - bundles to enable