/** * Customize the internal bean factory used by this context. Called for each {@link #refresh()} * attempt. * * <p>The default implementation applies this context's {@linkplain * #setAllowBeanDefinitionOverriding "allowBeanDefinitionOverriding"} and {@linkplain * #setAllowCircularReferences "allowCircularReferences"} settings, if specified. Can be * overridden in subclasses to customize any of {@link DefaultListableBeanFactory}'s settings. * * @param beanFactory the newly created bean factory for this context * @see DefaultListableBeanFactory#setAllowBeanDefinitionOverriding * @see DefaultListableBeanFactory#setAllowCircularReferences * @see DefaultListableBeanFactory#setAllowRawInjectionDespiteWrapping * @see DefaultListableBeanFactory#setAllowEagerClassLoading */ protected void customizeBeanFactory(DefaultListableBeanFactory beanFactory) { if (this.allowBeanDefinitionOverriding != null) { beanFactory.setAllowBeanDefinitionOverriding(this.allowBeanDefinitionOverriding); } if (this.allowCircularReferences != null) { beanFactory.setAllowCircularReferences(this.allowCircularReferences); } beanFactory.setAutowireCandidateResolver(new QualifierAnnotationAutowireCandidateResolver()); }