类 QualifierAnnotationAutowireCandidateResolver

    • 方法详细资料

      • addQualifierType

        public void addQualifierType​(Class<? extends Annotation> qualifierType)
        Register the given type to be used as a qualifier when autowiring.

        This identifies qualifier annotations for direct use (on fields, method parameters and constructor parameters) as well as meta annotations that in turn identify actual qualifier annotations.

        This implementation only supports annotations as qualifier types. The default is Spring's Qualifier annotation which serves as a qualifier for direct use and also as a meta annotation.

        参数:
        qualifierType - the annotation type to register
      • setValueAnnotationType

        public void setValueAnnotationType​(Class<? extends Annotation> valueAnnotationType)
        Set the 'value' annotation type, to be used on fields, method parameters and constructor parameters.

        The default value annotation type is the Spring-provided Value annotation.

        This setter property exists so that developers can provide their own (non-Spring-specific) annotation type to indicate a default value expression for a specific argument.

      • isAutowireCandidate

        public boolean isAutowireCandidate​(BeanDefinitionHolder bdHolder,
                                           DependencyDescriptor descriptor)
        Determine whether the provided bean definition is an autowire candidate.

        To be considered a candidate the bean's autowire-candidate attribute must not have been set to 'false'. Also, if an annotation on the field or parameter to be autowired is recognized by this bean factory as a qualifier, the bean must 'match' against the annotation as well as any attributes it may contain. The bean definition must contain the same qualifier or match by meta attributes. A "value" attribute will fallback to match against the bean name or an alias if a qualifier or attribute does not match.

        指定者:
        isAutowireCandidate 在接口中 AutowireCandidateResolver
        覆盖:
        isAutowireCandidate 在类中 GenericTypeAwareAutowireCandidateResolver
        参数:
        bdHolder - the bean definition including bean name and aliases
        descriptor - the descriptor for the target method parameter or field
        返回:
        whether the bean definition qualifies as autowire candidate
        另请参阅:
        Qualifier
      • isQualifier

        protected boolean isQualifier​(Class<? extends Annotation> annotationType)
        Checks whether the given annotation type is a recognized qualifier type.
      • isRequired

        public boolean isRequired​(DependencyDescriptor descriptor)
        Determine whether the given dependency declares an autowired annotation, checking its required flag.
        覆盖:
        isRequired 在类中 SimpleAutowireCandidateResolver
        参数:
        descriptor - the descriptor for the target method parameter or field
        返回:
        whether the descriptor is marked as required or possibly indicating non-required status some other way (e.g. through a parameter annotation)
        另请参阅:
        Autowired.required()
      • findValue

        protected Object findValue​(Annotation[] annotationsToSearch)
        Determine a suggested value from any of the given candidate annotations.