Example usage for org.springframework.context.annotation ScannedGenericBeanDefinition getConstructorArgumentValues

List of usage examples for org.springframework.context.annotation ScannedGenericBeanDefinition getConstructorArgumentValues

Introduction

In this page you can find the example usage for org.springframework.context.annotation ScannedGenericBeanDefinition getConstructorArgumentValues.

Prototype

@Override
public ConstructorArgumentValues getConstructorArgumentValues() 

Source Link

Document

Return constructor argument values for this bean (never null ).

Usage

From source file:org.devefx.httpmapper.spring.mapper.ClassPathMapperScanner.java

private void processBeanDefinitions(Set<BeanDefinitionHolder> beanDefinitions) {
    ScannedGenericBeanDefinition definition;
    for (BeanDefinitionHolder holder : beanDefinitions) {
        definition = (ScannedGenericBeanDefinition) holder.getBeanDefinition();

        if (logger.isDebugEnabled()) {
            logger.debug("Creating MapperFactoryBean with name '" + holder.getBeanName() + "' and '"
                    + definition.getBeanClassName() + "' mapperInterface");
        }/*from   w  w  w  .ja  v  a2  s.  com*/
        // the mapper interface is the original class of the bean
        // but, the actual class of the bean is MapperFactoryBean
        definition.getConstructorArgumentValues().addGenericArgumentValue(definition.getBeanClassName());
        definition.setBeanClass(this.factoryBeanClass);

        boolean explicitFactoryUsed = false;
        if (StringUtils.hasText(this.configBeanName)) {
            definition.getPropertyValues().add("config", new RuntimeBeanReference(this.configBeanName));
            explicitFactoryUsed = true;
        }

        if (!explicitFactoryUsed) {
            if (logger.isDebugEnabled()) {
                logger.debug("Enabling autowire by type for MapperFactoryBean with name '"
                        + holder.getBeanName() + "'.");
            }
            definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);
        }
    }
}