Search in sources :

Example 1 with BeanWiringInfoResolver

use of org.springframework.beans.factory.wiring.BeanWiringInfoResolver in project cxf by apache.

the class ConfigurerImpl method configureBean.

public synchronized void configureBean(String bn, Object beanInstance, boolean checkWildcards) {
    if (null == appContexts) {
        return;
    }
    if (null == bn) {
        bn = getBeanName(beanInstance);
    }
    if (null == bn) {
        return;
    }
    if (checkWildcards) {
        configureWithWildCard(bn, beanInstance);
    }
    final String beanName = bn;
    setBeanWiringInfoResolver(new BeanWiringInfoResolver() {

        public BeanWiringInfo resolveWiringInfo(Object instance) {
            if (!"".equals(beanName)) {
                return new BeanWiringInfo(beanName);
            }
            return null;
        }
    });
    for (ApplicationContext appContext : appContexts) {
        if (appContext.containsBean(bn)) {
            this.setBeanFactory(appContext.getAutowireCapableBeanFactory());
        }
    }
    try {
        // this can leak memory
        if (beanFactory instanceof AbstractBeanFactory) {
            ((AbstractBeanFactory) beanFactory).getMergedBeanDefinition(bn);
        }
        super.configureBean(beanInstance);
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Successfully performed injection.");
        }
    } catch (NoSuchBeanDefinitionException ex) {
        // incorrect bean ids
        if (LOG.isLoggable(Level.FINE)) {
            LOG.log(Level.FINE, "NO_MATCHING_BEAN_MSG", beanName);
        }
    }
}
Also used : BeanWiringInfo(org.springframework.beans.factory.wiring.BeanWiringInfo) ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) AbstractBeanFactory(org.springframework.beans.factory.support.AbstractBeanFactory) BeanWiringInfoResolver(org.springframework.beans.factory.wiring.BeanWiringInfoResolver) NoSuchBeanDefinitionException(org.springframework.beans.factory.NoSuchBeanDefinitionException)

Aggregations

NoSuchBeanDefinitionException (org.springframework.beans.factory.NoSuchBeanDefinitionException)1 AbstractBeanFactory (org.springframework.beans.factory.support.AbstractBeanFactory)1 BeanWiringInfo (org.springframework.beans.factory.wiring.BeanWiringInfo)1 BeanWiringInfoResolver (org.springframework.beans.factory.wiring.BeanWiringInfoResolver)1 ApplicationContext (org.springframework.context.ApplicationContext)1 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)1