public class AnnotatedMethodComponentFinderStrategy extends AbstractComponentFinderStrategy
With example below this strategy finds 2 components based on method annotation@Bean, e.g. component with name "SomeComponent" has efferent relation to "SomeEfferentComponent".@Configurationpublic class SomeConfiguration {@Beanpublic SomeComponent someComponent(SomeEfferentComponent someEfferentComponent) { return new SomeComponentImpl(someEfferentComponent); }@Beanpublic SomeEfferentComponent someEfferentComponent() { return new SomeEfferentComponentImpl(); } }
componentFinder, componentsFound, supportingTypesStrategies| Constructor and Description |
|---|
AnnotatedMethodComponentFinderStrategy(java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotation)
Construct strategy that finds components based on return type of methods annotated with
methodAnnotation |
AnnotatedMethodComponentFinderStrategy(java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> classAnnotation)
Construct strategy that finds components based on return type of methods annotated with
methodAnnotation
which belong only to classes annotated with classAnnotation |
AnnotatedMethodComponentFinderStrategy(java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> classAnnotation,
DuplicateComponentStrategy duplicateComponentStrategy,
SupportingTypesStrategy... strategies)
Construct strategy that finds components based on return type of methods annotated with
methodAnnotation
which belong only to classes annotated with classAnnotation. |
AnnotatedMethodComponentFinderStrategy(java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotation,
DuplicateComponentStrategy duplicateComponentStrategy) |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.Set<com.structurizr.model.Component> |
doFindComponents()
A template method into which subclasses can put their component finding code.
|
addComponent, addSupportingTypesStrategy, afterFindComponents, beforeFindComponents, findClassesWithAnnotation, findClassesWithAnnotation, findComponents, findDependencies, findSupportingTypes, findTypesAnnotatedWith, getComponentFinder, getDuplicateComponentStrategy, getTypeRepository, setComponentFinder, setDuplicateComponentStrategypublic AnnotatedMethodComponentFinderStrategy(java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotation)
methodAnnotationmethodAnnotation - the annotation to look for on methodspublic AnnotatedMethodComponentFinderStrategy(java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotation,
DuplicateComponentStrategy duplicateComponentStrategy)
public AnnotatedMethodComponentFinderStrategy(java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> classAnnotation)
methodAnnotation
which belong only to classes annotated with classAnnotationmethodAnnotation - the annotation to look for on methodsclassAnnotation - the annotation to look for on classes/interfacespublic AnnotatedMethodComponentFinderStrategy(@Nonnull
java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotation,
@Nullable
java.lang.Class<? extends java.lang.annotation.Annotation> classAnnotation,
@Nullable
DuplicateComponentStrategy duplicateComponentStrategy,
SupportingTypesStrategy... strategies)
methodAnnotation
which belong only to classes annotated with classAnnotation.methodAnnotation - the annotation to look for on methodsclassAnnotation - the annotation to look for on classes/interfaces to narrow scanned scope of methodsduplicateComponentStrategy - strategy how to behave when component duplicates foundstrategies - strategies to look for supporting types for a component
(component hides all types which support defined in component functionality behind abstraction)protected java.util.Set<com.structurizr.model.Component> doFindComponents()
AbstractComponentFinderStrategydoFindComponents in class AbstractComponentFinderStrategy