Class AcrossDynamicModulesConfigurer

java.lang.Object
com.foreach.across.config.AcrossDynamicModulesConfigurer
All Implemented Interfaces:
AcrossContextConfigurer
Direct Known Subclasses:
AcrossDynamicModulesConfiguration

public class AcrossDynamicModulesConfigurer extends Object implements AcrossContextConfigurer
AcrossContextConfigurer bean that will add dynamic modules to an AcrossContext. It will do so by scanning a base package (setBasePackage(String) for child packages application, infrastructure and postprocessor. For each of these found, a module with the respective role will be added. The name of the module will be determined by the base module name (setBaseModuleName(String)).

If there is a ModuleDependencyResolver found in the bean factory, it will be used to resolve the corresponding modules. This way an implemented AcrossModule descriptor will automatically be picked up.

Can also be configured from a single class instance that will be used for determining the base package and base module name. See also AcrossDynamicModulesConfiguration for a Configuration that will use the importing class as base.

Since:
1.1.2
Author:
Arne Vandamme
See Also:
  • Constructor Details

    • AcrossDynamicModulesConfigurer

      public AcrossDynamicModulesConfigurer()
    • AcrossDynamicModulesConfigurer

      public AcrossDynamicModulesConfigurer(Class<?> applicationClass)
    • AcrossDynamicModulesConfigurer

      public AcrossDynamicModulesConfigurer(String basePackage, String baseModuleName)
  • Method Details

    • setBasePackage

      public void setBasePackage(String basePackage)
      The base package that should be scanned for modules. Can also be set through a single setApplicationClass(Class).
      Parameters:
      basePackage - package name
    • setBaseModuleName

      public void setBaseModuleName(String baseModuleName)
      The base module name that should be used. If dynamic modules are added, their names will be prefixed with the base module name. Resulting in either BASEApplicationModule, BASEInfrastructureModule or BASEPostProcessorModule.
      Parameters:
      baseModuleName - module name prefix
    • setApplicationClass

      public void setApplicationClass(Class<?> clazz)
      Set a single class from that is in the base package, and determine a base module name from the class name. If the simple class name ends with Application (eg. MyCurrentApplication), the part before Application will be used as base module name (eg. MyCurrent); else the simple class name will be used.
      Parameters:
      clazz - instance
    • getBasePackage

      protected String getBasePackage()
    • setResourcePatternResolver

      public void setResourcePatternResolver(org.springframework.core.io.support.ResourcePatternResolver resourcePatternResolver)
      Set the ResourcePatternResolver that should be used for classpath scanning. Defaults to a PathMatchingResourcePatternResolver.
      Parameters:
      resourcePatternResolver - resolver
    • setMetadataReaderFactory

      public void setMetadataReaderFactory(org.springframework.core.type.classreading.MetadataReaderFactory metadataReaderFactory)
      Set the MetadataReaderFactory that should be used by the classpath scanner. Defaults to a new instance of CachingMetadataReaderFactory.
      Parameters:
      metadataReaderFactory - to use
    • configure

      public void configure(AcrossContext context)
      Specified by:
      configure in interface AcrossContextConfigurer