2017-06-27 94 views
2

我不知道是否有一个Java DSL或至少配置替代了Spring集成的XML验证筛选Spring集成 - Java的DSL替代的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> 

预先感谢所有的支持!

回答

1

参考手册suggests examining the XML schema回答这样的问题。

如果您熟悉已经Spring集成XML配置,从4.3版本中,我们提供的XSD定义的元素与目标类用于生产适配器或网关豆指针的说明...

在这种情况下...

<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(...)) 

and with java config

@Bean 
@ServiceActivator(inputChannel = "...") 
public MessageFilter filter() { 
    return new MessageFilter(new XmlValidatingMessageSelector(...)); 
} 
+0

谢谢你,加里! –

+0

请参阅[我应该怎么做当有人回答我的问题?](https://stackoverflow.com/help/someone-answers) - 它会帮助其他人寻找答案。 –