GH-166: Fix ChannelBinder config inconsistency

Fixes GH-166 (https://github.com/spring-cloud/spring-cloud-stream/issues/166)

Since `onInit()` in the `MessageChannelBinderSupport` was called before the `evaluationContext` population,
the `RedisMessageChannelBinder#errorAdapter` caused `NPE` for its `evaluationContext`.

* Change the initialization order
* Use `ExpressionUtils` to populate `evaluationContext` - creates `StandardEvaluationContext` if there is no one in the `applicationContext`
* Add more initializations for the `RedisMessageChannelBinder#errorAdapter`
* Remove explicit `evaluationContext` population from the `AbstractTestBinder` to rely on the fix for this ticket
* Some other simple polishing

Address PR comments
This commit is contained in:
Artem Bilan
2015-10-28 12:42:12 -04:00
committed by Marius Bogoevici
parent c979f1baa8
commit 2e7f9cc729
5 changed files with 26 additions and 22 deletions

View File

@@ -20,7 +20,6 @@ import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.messaging.MessageChannel;
@@ -39,7 +38,6 @@ public abstract class AbstractTestBinder<C extends MessageChannelBinderSupport>
private C binder;
public void setBinder(C binder) {
binder.setIntegrationEvaluationContext(new StandardEvaluationContext());
try {
binder.afterPropertiesSet();
}