Java Code Examples for org.springframework.integration.expression.ExpressionUtils#createStandardEvaluationContext()

The following examples show how to use org.springframework.integration.expression.ExpressionUtils#createStandardEvaluationContext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PartitionAwareFunctionWrapper.java    From spring-cloud-stream with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
PartitionAwareFunctionWrapper(FunctionInvocationWrapper function, ConfigurableApplicationContext context, ProducerProperties producerProperties) {
	this.function = function;
	if (producerProperties != null && producerProperties.isPartitioned()) {
		StandardEvaluationContext evaluationContext = ExpressionUtils.createStandardEvaluationContext(context.getBeanFactory());
		PartitionHandler partitionHandler = new PartitionHandler(evaluationContext, producerProperties, context.getBeanFactory());

		this.outputMessageEnricher = outputMessage -> {
			int partitionId = partitionHandler.determinePartition(outputMessage);
			return MessageBuilder
				.fromMessage(outputMessage)
				.setHeader(BinderHeaders.PARTITION_HEADER, partitionId).build();
		};
	}
	else {
		this.outputMessageEnricher = null;
	}
}
 
Example 2
Source File: MongodbProcessorConfiguration.java    From Hands-On-Reactive-Programming-in-Spring-5 with MIT License 5 votes vote down vote up
public MongodbProcessorConfiguration(
	MongodbProcessorProperties properties,
	ReactiveMongoOperations mongoTemplate,
	BeanFactory beanFactory
) {
	this.properties = properties;
	this.mongoTemplate = mongoTemplate;
	this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(beanFactory);
}
 
Example 3
Source File: MessageConverterConfigurer.java    From spring-cloud-stream with Apache License 2.0 5 votes vote down vote up
PartitioningInterceptor(BindingProperties bindingProperties) {
	this.bindingProperties = bindingProperties;
	this.partitionHandler = new PartitionHandler(
			ExpressionUtils.createStandardEvaluationContext(
					MessageConverterConfigurer.this.beanFactory),
			this.bindingProperties.getProducer(), MessageConverterConfigurer.this.beanFactory);
}
 
Example 4
Source File: AbstractBinder.java    From spring-cloud-stream with Apache License 2.0 5 votes vote down vote up
@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());
	}
	onInit();
}
 
Example 5
Source File: KinesisMessageChannelBinder.java    From spring-cloud-stream-binder-aws-kinesis with Apache License 2.0 4 votes vote down vote up
@Override
protected void onInit() throws Exception {
	super.onInit();
	this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
}
 
Example 6
Source File: PubSubMessageHandler.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
@Override
protected void onInit() {
	super.onInit();
	this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
}
 
Example 7
Source File: BigQueryFileMessageHandler.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
@Override
protected void doInit() {
	this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
}
 
Example 8
Source File: JdbcSinkConfiguration.java    From spring-cloud-stream-app-starters with Apache License 2.0 4 votes vote down vote up
@PostConstruct
public void afterPropertiesSet() {
	this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(beanFactory);
}
 
Example 9
Source File: SpelExpressionConverterConfigurationTests.java    From spring-cloud-stream with Apache License 2.0 4 votes vote down vote up
@Bean
public EvaluationContext evaluationContext() {
	return ExpressionUtils.createStandardEvaluationContext(this.beanFactory);
}
 
Example 10
Source File: SpelExpressionConverterConfigurationTests.java    From spring-cloud-stream with Apache License 2.0 4 votes vote down vote up
@PostConstruct
public void setup() {
	this.evaluationContext = ExpressionUtils
			.createStandardEvaluationContext(this.beanFactory);
}