Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Integration filter expression using SPeL

I have a configuration bean that has a list of allowed values:

@Component
public class Conf {
    public List<String> getAllowedValues() {
        return Arrays.asList("A", "B", "C", "D");
}

I have populated my message headers with a field called 'someValue' and I want to use a filter element to exclude messages where someValue is not in the allowed values list.

My context looks like this:

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

But I get: SpelParseException: EL1041E:(pos 1): After parsing a valid expression, there is still more data in the expression: 'comma(,)'

like image 640
Paul McKenzie Avatar asked May 10 '26 05:05

Paul McKenzie


1 Answers

The answer was provided here:

<int:filter expression="@conf.allowedValues.contains(headers.get('someValue'))"/>
like image 93
Paul McKenzie Avatar answered May 16 '26 04:05

Paul McKenzie