/** * Return if there are constructor argument values defined for this bean. * @since 5.0.2 */ default boolean hasConstructorArgumentValues() { return !getConstructorArgumentValues().isEmpty(); }
/** * Determine whether the specified bean is eligible for inclusion in the * LiveBeansView JSON snapshot. * @param beanName the name of the bean * @param bd the corresponding bean definition * @param bf the containing bean factory * @return {@code true} if the bean is to be included; {@code false} otherwise */ protected boolean isBeanEligible(String beanName, BeanDefinition bd, ConfigurableBeanFactory bf) { return (bd.getRole() != BeanDefinition.ROLE_INFRASTRUCTURE && (!bd.isLazyInit() || bf.containsSingleton(beanName))); }
@Override protected boolean isEligibleAdvisorBean(String beanName) { return (this.beanFactory != null && this.beanFactory.containsBeanDefinition(beanName) && this.beanFactory.getBeanDefinition(beanName).getRole() == BeanDefinition.ROLE_INFRASTRUCTURE); }
@Override public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) { return bdHolder.getBeanDefinition().isAutowireCandidate(); }
@Override public TypeResolverBuilder<?> typeResolverBuilderInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass) { return (TypeResolverBuilder<?>) this.beanFactory.createBean(implClass); }
/** * Register the given BeanPostProcessor beans. */ private static void registerBeanPostProcessors( ConfigurableListableBeanFactory beanFactory, List<BeanPostProcessor> postProcessors) { for (BeanPostProcessor postProcessor : postProcessors) { beanFactory.addBeanPostProcessor(postProcessor); } }
public EmbeddedValueResolver(ConfigurableBeanFactory beanFactory) { this.exprContext = new BeanExpressionContext(beanFactory, null); this.exprResolver = beanFactory.getBeanExpressionResolver(); }
@Override public Class<?> getTargetClass() { return descriptor.getDependencyType(); } @Override
public boolean containsObject(String key) { return (this.beanFactory.containsBean(key) || (this.scope != null && this.scope.resolveContextualObject(key) != null)); }
/** * Eagerly create the singleton instance, if necessary. */ @Override public void afterPropertiesSet() throws Exception { if (isSingleton()) { this.initialized = true; this.singletonInstance = createInstance(); this.earlySingletonInstance = null; } }
/** * Deep copy constructor. * @param original the ConstructorArgumentValues to copy */ public ConstructorArgumentValues(ConstructorArgumentValues original) { addArgumentValues(original); }
@Override public void setBeanFactory(BeanFactory beanFactory) { if (beanFactory instanceof ConfigurableBeanFactory) { this.embeddedValueResolver = new EmbeddedValueResolver((ConfigurableBeanFactory) beanFactory); } }
/** * Visit each bean definition in the given bean factory and attempt to replace ${...} property * placeholders with values from the given properties. */ @Override protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException { StringValueResolver valueResolver = new PlaceholderResolvingStringValueResolver(props); doProcessProperties(beanFactoryToProcess, valueResolver); }
@Override public void afterPropertiesSet() throws Exception { prepare(); if (this.singleton) { this.initialized = true; this.singletonObject = invokeWithTargetException(); } }
@Override public void setBeanFactory(BeanFactory beanFactory) { if (beanFactory instanceof ConfigurableListableBeanFactory) { ((ConfigurableListableBeanFactory) beanFactory).ignoreDependencyType(MetaClass.class); } }
@Override public final void afterPropertiesSet() throws IOException { if (this.singleton) { this.singletonInstance = createProperties(); } }
@Override public void setBeanFactory(BeanFactory beanFactory) { this.beanFactory = (AutowireCapableBeanFactory) beanFactory; this.beanFactory.applyBeanPostProcessorsBeforeInitialization(this.testBean, this.beanName); }
/** * Determine whether the given bean definition qualifies as an * autowire candidate for the given dependency. * <p>The default implementation checks * {@link org.springframework.beans.factory.config.BeanDefinition#isAutowireCandidate()}. * @param bdHolder the bean definition including bean name and aliases * @param descriptor the descriptor for the target method parameter or field * @return whether the bean definition qualifies as autowire candidate * @see org.springframework.beans.factory.config.BeanDefinition#isAutowireCandidate() */ default boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) { return bdHolder.getBeanDefinition().isAutowireCandidate(); }
/** @since 4.3 */ @Override public ValueInstantiator valueInstantiatorInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass) { return (ValueInstantiator) this.beanFactory.createBean(implClass); }
@Override public JsonSerializer<?> serializerInstance(SerializationConfig config, Annotated annotated, Class<?> implClass) { return (JsonSerializer<?>) this.beanFactory.createBean(implClass); }