diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/HeaderEnricherParserSupport.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/HeaderEnricherParserSupport.java
index 952d9430d1..4e5f925cbb 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/HeaderEnricherParserSupport.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/HeaderEnricherParserSupport.java
@@ -66,6 +66,7 @@ public abstract class HeaderEnricherParserSupport extends AbstractTransformerPar
this.processHeaders(element, headers, parserContext);
builder.addConstructorArgValue(headers);
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "default-overwrite");
+ IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "should-skip-nulls");
this.postProcessHeaderEnricher(builder, element, parserContext);
}
diff --git a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd
index c7efe1c4d0..732fa98bec 100644
--- a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd
+++ b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd
@@ -1264,6 +1264,18 @@
+
+
+
+ Specify whether null values, such as might be returned from an expression evaluation,
+ should be skipped. The default value is true. Set this to false if a null value should
+ trigger removal of the corresponding header instead.
+
+
+
+
+
+
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherParserTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherParserTests-context.xml
index f652af64f6..20ab4cf9d5 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherParserTests-context.xml
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherParserTests-context.xml
@@ -7,8 +7,20 @@
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd">
+
+
+
+
+
+
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherParserTests.java
index bf34430c66..b56c2d06b2 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherParserTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherParserTests.java
@@ -39,6 +39,13 @@ public class HeaderEnricherParserTests {
private ApplicationContext context;
+ @Test // INT-1154
+ public void sendTimeoutDefault() {
+ Object endpoint = context.getBean("headerEnricherWithDefaults");
+ long sendTimeout = TestUtils.getPropertyValue(endpoint, "handler.channelTemplate.sendTimeout", Long.class).longValue();
+ assertEquals(1000L, sendTimeout);
+ }
+
@Test // INT-1154
public void sendTimeoutConfigured() {
Object endpoint = context.getBean("headerEnricherWithSendTimeout");
@@ -46,4 +53,25 @@ public class HeaderEnricherParserTests {
assertEquals(1234L, sendTimeout);
}
+ @Test // INT-1167
+ public void shouldSkipNullsDefault() {
+ Object endpoint = context.getBean("headerEnricherWithDefaults");
+ Boolean shouldSkipNulls = TestUtils.getPropertyValue(endpoint, "handler.transformer.shouldSkipNulls", Boolean.class);
+ assertEquals(Boolean.TRUE, shouldSkipNulls);
+ }
+
+ @Test // INT-1167
+ public void shouldSkipNullsFalseConfigured() {
+ Object endpoint = context.getBean("headerEnricherWithShouldSkipNullsFalse");
+ Boolean shouldSkipNulls = TestUtils.getPropertyValue(endpoint, "handler.transformer.shouldSkipNulls", Boolean.class);
+ assertEquals(Boolean.FALSE, shouldSkipNulls);
+ }
+
+ @Test // INT-1167
+ public void shouldSkipNullsTrueConfigured() {
+ Object endpoint = context.getBean("headerEnricherWithShouldSkipNullsTrue");
+ Boolean shouldSkipNulls = TestUtils.getPropertyValue(endpoint, "handler.transformer.shouldSkipNulls", Boolean.class);
+ assertEquals(Boolean.TRUE, shouldSkipNulls);
+ }
+
}