当Spring中 有多个构造函数的时候,是如何得到候选的构造方法
AbstractAutowireCapableBeanFactory#determineConstructorsFromBeanPostProcessors
其中主要的是 AutowiredAnnotationBeanPostProcessor 这个类
AutowiredAnnotationBeanPostProcessor#determineCandidateConstructors 得到候选的构造方法
1、找存在@Lookup注解的方法
1、先从缓存中判断当前bean是否找过
AutowiredAnnotationBeanPostProcessor#lookupMethodsChecked
private final Set<String> lookupMethodsChecked = Collections.newSetFromMap(new ConcurrentHashMap<>(256));
2、没有找过执行查找
3、如果存在添加到当前BeanDefinition的#methodOverrides中
2、 找当前bean的候选构造方法
1、先从缓存中判断当前bean是否找过
AutowiredAnnotationBeanPostProcessor#candidateConstructorsCache
private final Map<Class<?>, Constructor<?>[]> candidateConstructorsCache = new ConcurrentHashMap<>(256)