|
30 | 30 | import org.springframework.expression.TypeLocator;
|
31 | 31 | import org.springframework.expression.spel.support.StandardEvaluationContext;
|
32 | 32 | import org.springframework.expression.spel.support.StandardTypeLocator;
|
| 33 | +import org.springframework.integration.expression.ExpressionUtils; |
33 | 34 | import org.springframework.integration.expression.IntegrationEvaluationContextAware;
|
34 | 35 | import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
35 | 36 | import org.springframework.integration.handler.ExpressionEvaluatingMessageProcessor;
|
|
47 | 48 | * @author Artem Bilan
|
48 | 49 | */
|
49 | 50 | @SuppressWarnings("unchecked")
|
50 |
| -public class CassandraMessageHandler<T> extends AbstractReplyProducingMessageHandler |
51 |
| - implements IntegrationEvaluationContextAware { |
| 51 | +public class CassandraMessageHandler<T> extends AbstractReplyProducingMessageHandler { |
52 | 52 |
|
53 | 53 | private final Map<String, Expression> parameterExpressions = new HashMap<>();
|
54 | 54 |
|
@@ -153,21 +153,22 @@ public void setStatementProcessor(MessageProcessor<Statement> statementProcessor
|
153 | 153 | }
|
154 | 154 |
|
155 | 155 | @Override
|
156 |
| - public void setIntegrationEvaluationContext(EvaluationContext evaluationContext) { |
157 |
| - TypeLocator typeLocator = evaluationContext.getTypeLocator(); |
| 156 | + public String getComponentType() { |
| 157 | + return "cassandra:outbound-" + (this.producesReply ? "gateway" : "channel-adapter"); |
| 158 | + } |
| 159 | + |
| 160 | + @Override |
| 161 | + protected void doInit() { |
| 162 | + super.doInit(); |
| 163 | + |
| 164 | + this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); |
| 165 | + TypeLocator typeLocator = this.evaluationContext.getTypeLocator(); |
158 | 166 | if (typeLocator instanceof StandardTypeLocator) {
|
159 | 167 | /*
|
160 | 168 | * Register the Cassandra Query DSL package so they don't need a FQCN for QueryBuilder, for example.
|
161 | 169 | */
|
162 | 170 | ((StandardTypeLocator) typeLocator).registerImport("com.datastax.driver.core.querybuilder");
|
163 | 171 | }
|
164 |
| - this.evaluationContext = evaluationContext; |
165 |
| - } |
166 |
| - |
167 |
| - |
168 |
| - @Override |
169 |
| - public String getComponentType() { |
170 |
| - return "cassandra:outbound-" + (this.producesReply ? "gateway" : "channel-adapter"); |
171 | 172 | }
|
172 | 173 |
|
173 | 174 | @Override
|
|
0 commit comments