Spring integration 使用SPeL的Spring集成过滤器表达式

Spring integration 使用SPeL的Spring集成过滤器表达式,spring-integration,spring-el,Spring Integration,Spring El,我有一个配置bean,它有一个允许值列表: @Component public class Conf { public List<String> getAllowedValues() { return Arrays.asList("A", "B", "C", "D"); } @组件 公共类配置{ 公共列表getAllowedValues(){ 返回数组。asList(“A”、“B”、“C”、“D”); } 我已经用一个名为“someValue”的字段填充了

我有一个配置bean,它有一个允许值列表:

@Component
public class Conf {
    public List<String> getAllowedValues() {
        return Arrays.asList("A", "B", "C", "D");
}
@组件
公共类配置{
公共列表getAllowedValues(){
返回数组。asList(“A”、“B”、“C”、“D”);
}
我已经用一个名为“someValue”的字段填充了我的消息头,我想使用一个过滤器元素来排除someValue不在允许值列表中的消息

我的上下文如下所示:

<int:filter expression="#{conf.allowedValues}.contains(headers.get('someValue'))"/>

但是我得到:
SpelParseException:EL1041E:(位置1):解析有效表达式后,表达式中还有更多数据:“逗号(,)”
提供了答案:


我找到了一个更简单(也许不是最好)的解决方案

<int:filter expression="{"A", "B", "C", "D"}.contains(headers.get('someValue'))" />

<int:filter expression="{"A", "B", "C", "D"}.contains(headers.get('someValue'))" />