Java 类org.springframework.context.expression.BeanFactoryAccessor 实例源码

项目:dubbox-solr    文件:SimpleSolrPersistentEntity.java   
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {

    context.addPropertyAccessor(new BeanFactoryAccessor());
    context.setBeanResolver(new BeanFactoryResolver(applicationContext));
    context.setRootObject(applicationContext);
}
项目:spring-data-solr    文件:SimpleSolrPersistentEntity.java   
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {

    context.addPropertyAccessor(new BeanFactoryAccessor());
    context.setBeanResolver(new BeanFactoryResolver(applicationContext));
    context.setRootObject(applicationContext);
}
项目:reactor-spring    文件:ConsumerBeanAutoConfiguration.java   
public ConsumerBeanAutoConfiguration() {
    this.expressionParser = new SpelExpressionParser();

    this.expressionPropertyAccessors = new ArrayList<PropertyAccessor>();
    this.expressionPropertyAccessors.add(new EnvironmentAccessor());
    this.expressionPropertyAccessors.add(new BeanFactoryAccessor());
    this.expressionPropertyAccessors.add(new ReflectivePropertyAccessor());
    this.expressionPropertyAccessors.add(new DirectFieldAccessPropertyAccessor());
}
项目:spring-data-documentdb    文件:BasicDocumentDbPersistentEntity.java   
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    context.addPropertyAccessor(new BeanFactoryAccessor());
    context.setBeanResolver(new BeanFactoryResolver(applicationContext));
    context.setRootObject(applicationContext);
}
项目:spring-data-cloudant    文件:BasicCloudantPersistentEntity.java   
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    context.addPropertyAccessor(new BeanFactoryAccessor());
    context.setBeanResolver(new BeanFactoryResolver(applicationContext));
    context.setRootObject(applicationContext);
}
项目:spring-data-crate    文件:SimpleCratePersistentEntity.java   
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    context.addPropertyAccessor(new BeanFactoryAccessor());
    context.setBeanResolver(new BeanFactoryResolver(applicationContext));
    context.setRootObject(applicationContext);
}
项目:arondor-common-reflection    文件:BeanPropertyParser.java   
public ElementConfiguration parseProperty(Object value)
{
    LOGGER.debug("value : " + value);
    if (value instanceof TypedStringValue)
    {
        TypedStringValue stringValue = (TypedStringValue) value;
        if (stringValue.getTargetTypeName() != null)
        {
            return getEnumObjectConfiguration(stringValue);
        }
        else
        {
            PrimitiveConfiguration primitiveConfiguration = objectConfigurationFactory
                    .createPrimitiveConfiguration();
            if (useSPEL(stringValue))
            {
                ExpressionParser parser = new SpelExpressionParser();
                String expAsStringWithToken = stringValue.getValue().trim();
                String expAsString = expAsStringWithToken.substring(2, expAsStringWithToken.length() - 1).trim();
                LOGGER.trace("This property is a SPEL expression: " + expAsString);

                // String regex = "systemProperties\\['([^\\s]+)'\\]";

                Expression exp = parser.parseExpression(expAsString);
                StandardEvaluationContext sec = null;
                if (sec == null)
                {
                    sec = new StandardEvaluationContext();
                    sec.addPropertyAccessor(new EnvironmentAccessor());
                    sec.addPropertyAccessor(new BeanExpressionContextAccessor());
                    sec.addPropertyAccessor(new BeanFactoryAccessor());
                    sec.addPropertyAccessor(new MapAccessor());
                }
                primitiveConfiguration.setValue(String.valueOf(exp.getValue()));
            }
            else
            {
                LOGGER.trace("This property is NOT a SPEL expression: " + stringValue.getValue());
                primitiveConfiguration.setValue(stringValue.getValue());
            }
            return primitiveConfiguration;
        }
    }
    else if (value instanceof RuntimeBeanReference)
    {
        RuntimeBeanReference beanReference = (RuntimeBeanReference) value;
        ReferenceConfiguration referenceConfiguration = objectConfigurationFactory.createReferenceConfiguration();
        referenceConfiguration.setReferenceName(beanReference.getBeanName());
        return referenceConfiguration;
    }
    else if (value instanceof ManagedList<?>)
    {
        return parseValueList((ManagedList<?>) value);
    }
    else if (value instanceof ManagedMap<?, ?>)
    {
        return parseValueMap((ManagedMap<?, ?>) value);
    }
    else if (value instanceof BeanDefinitionHolder)
    {
        BeanDefinitionHolder beanDefinitionHolder = (BeanDefinitionHolder) value;
        return parseBeanDefinition(beanDefinitionHolder.getBeanDefinition());
    }
    else
    {
        throw new UnsupportedOperationException("The type of property value is not suppported : " + value
                + " (class : " + value.getClass().getName() + ")");
    }
}