Example usage for org.springframework.integration.expression ExpressionUtils createStandardEvaluationContext

List of usage examples for org.springframework.integration.expression ExpressionUtils createStandardEvaluationContext

Introduction

In this page you can find the example usage for org.springframework.integration.expression ExpressionUtils createStandardEvaluationContext.

Prototype

public static StandardEvaluationContext createStandardEvaluationContext(BeanFactory beanFactory) 

Source Link

Document

Obtains the context from the beanFactory if not null; emits a warning if the beanFactory is null.

Usage

From source file:org.springframework.cloud.stream.app.jdbc.sink.JdbcSinkConfiguration.java

@PostConstruct
public void afterPropertiesSet() {
    this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(beanFactory);
}

From source file:org.springframework.cloud.stream.binder.AbstractBinder.java

@Override
public final void afterPropertiesSet() throws Exception {
    Assert.notNull(this.applicationContext, "The 'applicationContext' property must not be null");
    if (this.evaluationContext == null) {
        this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
    }/*from w  ww . j  ava  2s .  com*/
    onInit();
}

From source file:org.springframework.integration.file.FileWritingMessageHandler.java

@Override
public final void onInit() {

    super.onInit();

    this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory());

    if (this.destinationDirectoryExpression instanceof LiteralExpression) {
        final File directory = new File(
                this.destinationDirectoryExpression.getValue(this.evaluationContext, null, String.class));
        validateDestinationDirectory(directory, this.autoCreateDirectory);
    }//from  ww  w . ja v a  2  s.  co  m

    if (!this.fileNameGeneratorSet && this.fileNameGenerator instanceof BeanFactoryAware) {
        ((BeanFactoryAware) this.fileNameGenerator).setBeanFactory(this.getBeanFactory());
    }
}

From source file:org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.java

public void setBeanFactory(final BeanFactory beanFactory) {
    if (beanFactory != null) {
        this.beanFactory = beanFactory;
        this.payloadExpressionEvaluationContext = ExpressionUtils.createStandardEvaluationContext(beanFactory);
    }/*from  ww  w. j  ava2s .c  o m*/
}

From source file:org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.java

private StandardEvaluationContext createMethodInvocationEvaluationContext(Object[] arguments) {
    StandardEvaluationContext context = ExpressionUtils.createStandardEvaluationContext(this.beanFactory);
    context.setVariable("args", arguments);
    context.setVariable("method", this.method.getName());
    return context;
}

From source file:org.springframework.integration.handler.LoggingHandler.java

@Override
protected void onInit() throws Exception {
    super.onInit();
    this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory());
}

From source file:org.springframework.integration.mail.AbstractMailReceiver.java

@Override
protected void onInit() throws Exception {
    super.onInit();
    this.folderOpenMode = Folder.READ_WRITE;
    this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory());
    this.initialized = true;
}

From source file:org.springframework.integration.redis.outbound.RedisStoreWritingMessageHandler.java

@Override
protected void onInit() throws Exception {
    this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory());
    Assert.state(!this.mapKeyExpressionExplicitlySet
            || (this.collectionType == CollectionType.MAP || this.collectionType == CollectionType.PROPERTIES),
            "'mapKeyExpression' can only be set for CollectionType.MAP or CollectionType.PROPERTIES");
    if (!this.redisTemplateExplicitlySet) {
        if (!this.extractPayloadElements) {
            RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
            StringRedisSerializer serializer = new StringRedisSerializer();
            template.setKeySerializer(serializer);
            template.setHashKeySerializer(serializer);
            this.redisTemplate = template;
        }// www . j  av a 2s  .co  m
        this.redisTemplate.setConnectionFactory(this.connectionFactory);
        this.redisTemplate.afterPropertiesSet();
    }
    this.initialized = true;
}