Skip to content

Commit 5df59f8

Browse files
committed
refactor: XmlBeanDefinitionBuilder.unsupportedAttributeWarning()
1 parent 2fadcae commit 5df59f8

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

int-aws-support/src/main/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParser.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
import org.springframework.integration.config.xml.AbstractOutboundChannelAdapterParser;
88
import org.w3c.dom.Element;
99

10-
import java.util.List;
11-
1210
public class SqsOutboundChannelAdapterParser extends AbstractOutboundChannelAdapterParser {
1311

1412
@Override
1513
protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) {
1614
var builder = XmlBeanDefinitionBuilder.newInstance(element, parserContext, SqsMessageHandler.class)
15+
.unsupportedAttributeWarning("failure-channel", "resource-id-resolver", "error-message-strategy", "async-handler")
1716
.addConstructorArgReference("sqs")
1817
.setExpressionValueIfAttributeDefined("queue")
1918
.setExpressionValueIfAttributeDefined("delay")
@@ -35,12 +34,6 @@ protected AbstractBeanDefinition parseConsumer(Element element, ParserContext pa
3534
}
3635
}
3736

38-
for (var attribute : List.of("failure-channel", "resource-id-resolver", "error-message-strategy", "async-handler")) {
39-
if (element.hasAttribute(attribute)) {
40-
builder.warning("Attribute " + attribute + " not supported");
41-
}
42-
}
43-
4437
return builder.build();
4538
}
4639
}

int-aws-support/src/main/java/org/springframework/integration/aws/config/xml/XmlBeanDefinitionBuilder.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ public XmlBeanDefinitionBuilder setPropertyValueIfExclusiveAttributeDefined(Stri
108108
return this;
109109
}
110110

111+
public XmlBeanDefinitionBuilder unsupportedAttributeWarning(String... attributes) {
112+
for (var attribute : attributes) {
113+
if (element.hasAttribute(attribute)) {
114+
warning("'" + attribute + "' attribute not supported");
115+
}
116+
}
117+
return this;
118+
}
119+
111120
public XmlBeanDefinitionBuilder warning(String message, Throwable cause) {
112121
parserContext.getReaderContext().warning(message, element, cause);
113122
return this;

0 commit comments

Comments
 (0)