@@ -0,0 +1,2054 @@
+/*%0A * Copyright 2015 the original author or authors.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.springframework.cloud.stream.config;%0A%0Aimport org.springframework.context.annotation.Bean;%0Aimport org.springframework.context.annotation.Configuration;%0Aimport org.springframework.core.convert.converter.Converter;%0Aimport org.springframework.expression.Expression;%0Aimport org.springframework.expression.ParseException;%0Aimport org.springframework.expression.spel.standard.SpelExpressionParser;%0A%0A/**%0A * Adds a Converter from String to SpEL Expression in the context.%0A * By default, ConfigurationPropertiesBindingPostProcessor adds all converters it finds%0A * in the context to its own conversionService, so this is useful for binding properties%0A * of type Expression in %7B@literal @%7DConfigurationProperties annotated classes.%0A *%0A * @author Eric Bottard%0A */%0A@Configuration%0Apublic class SpelExpressionConverterConfiguration %7B%0A%0A%09@Bean%0A%09public Converter%3CString, Expression%3E spelConverter() %7B%0A%09%09return new SpelConverter();%0A%09%7D%0A%0A%09/**%0A%09 * A simple converter from String to Expression.%0A%09 *%0A%09 * @author Eric Bottard%0A%09 */%0A%09public static class SpelConverter implements Converter%3CString, Expression%3E %7B%0A%0A%09%09private SpelExpressionParser parser = new SpelExpressionParser();%0A%0A%09%09@Override%0A%09%09public Expression convert(String source) %7B%0A%09%09%09try %7B%0A%09%09%09%09return parser.parseExpression(source);%0A%09%09%09%7D%0A%09%09%09catch (ParseException e) %7B%0A%09%09%09%09throw new IllegalArgumentException(String.format(%22Could not convert '%25s' into a SpEL expression%22, source), e);%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%7D%0A

Add a converter String->Expression