Class GenericParametersAutowireCandidateResolver

  • All Implemented Interfaces:
    TeamCityAutowireCandidateResolver

    public class GenericParametersAutowireCandidateResolver
    extends java.lang.Object
    implements TeamCityAutowireCandidateResolver
    Created 02.10.12 18:23 This component resolves all dependency to a generic bean definition. Unfortunately Spring does not use generic type information for dependency resolution (so working with type-erasure) Due to Java limitations one need to explicitly inherit from a generic component to make true type substitution that would be visible for Java reflection. To make this component work you need to annotate your bean implementation with GenericResolvable annotation to specify raw type and arguments of generic interface you'd like to autowire. Note, this resolver is only one spring context wide. Proper dependency resolution may not work if there are beans candidates both from parent and child(ren) contexts There is a related issue in spring framework: https://jira.springsource.org/browse/SPR-9965
    Since:
    8.0
    Author:
    Eugene Petrenko (eugene.petrenko@jetbrains.com)
    See Also:
    GenericResolvable
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isAutowireCandidate​(java.lang.Class<?> dependencyType, java.lang.Class<?> beanType, java.lang.reflect.Type genericDependencyType)
      Determine whether the given bean qualifies as an autowire candidate for the given dependency.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GenericParametersAutowireCandidateResolver

        public GenericParametersAutowireCandidateResolver()
    • Method Detail

      • isAutowireCandidate

        public boolean isAutowireCandidate​(@NotNull
                                           java.lang.Class<?> dependencyType,
                                           @NotNull
                                           java.lang.Class<?> beanType,
                                           @Nullable
                                           java.lang.reflect.Type genericDependencyType)
        Description copied from interface: TeamCityAutowireCandidateResolver
        Determine whether the given bean qualifies as an autowire candidate for the given dependency.
        Specified by:
        isAutowireCandidate in interface TeamCityAutowireCandidateResolver
        Parameters:
        dependencyType - type of the dependency
        beanType - type of the bean
        genericDependencyType - generic type of the dependency
        Returns:
        whether the bean qualifies as autowire candidate