我想知道是否存在Java DSL或至少是Spring Integration的XML验证过滤器的配置选择
<int-xml:validating-filter discard-channel="" 1
id="" 2
input-channel="" 3
output-channel="" 4
schema-location="" 5
schema-type="xml-schema" 6
throw-exception-on-rejection="false" 7
xml-validator=""> 8
<int:poller .../> 9
</int-xml:validating-filter>
提前感谢您的支持!
答案 0 :(得分:1)
参考手册suggests examining the XML schema回答这样的问题。
如果您已熟悉Spring Integration XML配置,从版本4.3开始,我们在XSD元素定义中提供了指针的描述,其中目标类用于为适配器或网关生成bean ...
在这种情况下......
<xsd:element name="validating-filter">
<xsd:annotation>
<xsd:documentation>
Configures a Consumer Endpoint for the
'org.springframework.integration.filter.MessageFilter'
with an 'org.springframework.integration.xml.selector.XmlValidatingMessageSelector'
</xsd:documentation>
</xsd:annotation>
...
所以,使用DSL ......
.filter(new XmlValidatingMessageSelector(...))
和java config
@Bean
@ServiceActivator(inputChannel = "...")
public MessageFilter filter() {
return new MessageFilter(new XmlValidatingMessageSelector(...));
}