Annotation Type InjectModule


  • public @interface InjectModule
    Used to explicitly specify if it depends on externally provided beans or provides.

    External dependencies

    Use requires to specify dependencies that will be provided externally.

    {@code
    
       // tell the annotation processor Pump and Grinder are provided externally
       // otherwise it will think we have missing dependencies at compile time
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      String customScopeType
      Internal use only - identifies the custom scope annotation associated to this module.
      boolean ignoreSingleton
      Set to true to ignore anything annotated with @Singleton.
      String name
      Explicitly specify the name of the module.
      Class<?>[] provides
      Explicitly define features that are provided by this module and required by other modules.
      Class<?>[] requires
      The dependencies that are provided externally or by other modules and that are required when wiring this module.
      Class<?>[] requiresPackages
      Dependencies in these packages are expected to be provided by other modules.
    • Element Detail

      • name

        String name
        Explicitly specify the name of the module.
        Default:
        ""
      • ignoreSingleton

        boolean ignoreSingleton
        Set to true to ignore anything annotated with @Singleton.

        Set this to true when some other library is using @Singleton and we want avaje-inject to be completely independent of that by ignoring the standard @Singleton.

        We instead use @Component instead of @Singleton.

        Default:
        false
      • provides

        Class<?>[] provides
        Explicitly define features that are provided by this module and required by other modules.

        This is used to order wiring across multiple modules. Modules that provide dependencies should be wired before modules that require dependencies.

        Default:
        {}
      • requires

        Class<?>[] requires
        The dependencies that are provided externally or by other modules and that are required when wiring this module.

        This effectively tells the annotation processor that these types are expected to be provided and to not treat them as missing dependencies. If we don't do this the annotation processor thinks the dependency is missing and will error the compilation saying there is a missing dependency.

        Default:
        {}
      • requiresPackages

        Class<?>[] requiresPackages
        Dependencies in these packages are expected to be provided by other modules.

        Instead of listing each and every dependency in requires we can use this to specify that any required dependency that is in these packages is expected to be provided by another module.

        Use this rather than requires when there are lots of required dependencies, and we don't want to list each one in requires and provides.

        Default:
        {}
      • customScopeType

        String customScopeType
        Internal use only - identifies the custom scope annotation associated to this module.

        When a module is generated for a custom scope this is set to link the module back to the custom scope annotation and support partial compilation.

        Default:
        ""