Annotation Interface ConditionalOnMissingBroadleafModule
Allows for conditional registration of beans depending only if a particular Broadleaf module is absent. By default, this checks for the absence of
an implementation entry for a BroadleafModuleRegistration
in spring.factories
.
There are 2 options for checking these registrations:
- The type-safe
value()
which assumes that this class is kept up to date with different modules that are added - The
moduleName()
which maps directly to theBroadleafModuleRegistration.getModuleName()
Generally you should use the value()
attribute to give you a type-safe way to reference the registrations but it is possible
that you need to reference a module that has not yet been added to this class. In that case, use the moduleName()
parameter
which allows for more dynamic checking of module names.
If the module has not registered itself via spring.factories
then this will always return true.
This annotation can be used as a composed meta-annotation for module-specific annotations. Example:
@Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Documented @ConditionalOnMissingBroadleafModule(BroadleafModuleEnum.ACCOUNT) public @interface ConditionalOnAccountModule { }
- Since:
- 5.2
- Author:
- Brandon Hines
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThis should only be used if the module you are checking for has not yet been added to theBroadleafModuleRegistration.BroadleafModuleEnum
as that.Which module to check for the absence of.
-
Element Details
-
value
Which module to check for the absence of. This should generally be preferred to usingmoduleName()
but can be used as as stop-gap measurement if the module is not explicitly defined inBroadleafModuleRegistration.BroadleafModuleEnum
.- Default:
- IGNORED
-
moduleName
String moduleNameThis should only be used if the module you are checking for has not yet been added to theBroadleafModuleRegistration.BroadleafModuleEnum
as that. Generally you should seek to use thevalue()
parameter and add additional modules as needed.- Default:
- ""
-