Package com.foreach.across.config
Class AcrossDynamicModulesConfigurer
java.lang.Object
com.foreach.across.config.AcrossDynamicModulesConfigurer
- All Implemented Interfaces:
AcrossContextConfigurer
- Direct Known Subclasses:
AcrossDynamicModulesConfiguration
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 Summary
ConstructorDescriptionAcrossDynamicModulesConfigurer
(Class<?> applicationClass) AcrossDynamicModulesConfigurer
(String basePackage, String baseModuleName) -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(AcrossContext context) protected String
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.void
setBaseModuleName
(String baseModuleName) The base module name that should be used.void
setBasePackage
(String basePackage) The base package that should be scanned for modules.void
setMetadataReaderFactory
(org.springframework.core.type.classreading.MetadataReaderFactory metadataReaderFactory) Set theMetadataReaderFactory
that should be used by the classpath scanner.void
setResourcePatternResolver
(org.springframework.core.io.support.ResourcePatternResolver resourcePatternResolver) Set theResourcePatternResolver
that should be used for classpath scanning.
-
Constructor Details
-
AcrossDynamicModulesConfigurer
public AcrossDynamicModulesConfigurer() -
AcrossDynamicModulesConfigurer
-
AcrossDynamicModulesConfigurer
-
-
Method Details
-
setBasePackage
The base package that should be scanned for modules. Can also be set through a singlesetApplicationClass(Class)
.- Parameters:
basePackage
- package name
-
setBaseModuleName
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
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
-
setResourcePatternResolver
public void setResourcePatternResolver(org.springframework.core.io.support.ResourcePatternResolver resourcePatternResolver) Set theResourcePatternResolver
that should be used for classpath scanning. Defaults to aPathMatchingResourcePatternResolver
.- Parameters:
resourcePatternResolver
- resolver
-
setMetadataReaderFactory
public void setMetadataReaderFactory(org.springframework.core.type.classreading.MetadataReaderFactory metadataReaderFactory) Set theMetadataReaderFactory
that should be used by the classpath scanner. Defaults to a new instance ofCachingMetadataReaderFactory
.- Parameters:
metadataReaderFactory
- to use
-
configure
- Specified by:
configure
in interfaceAcrossContextConfigurer
-