INT-847 Upgraded to Spring 3.0.0.RELEASE
This commit is contained in:
@@ -11,14 +11,14 @@
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar" sourcepath="/IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-sources-1.1.1.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.aop/3.0.0.RC3/org.springframework.aop-3.0.0.RC3.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.aop/3.0.0.RC3/org.springframework.aop-sources-3.0.0.RC3.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.asm/3.0.0.RC3/org.springframework.asm-3.0.0.RC3.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.asm/3.0.0.RC3/org.springframework.asm-sources-3.0.0.RC3.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RC3/org.springframework.beans-3.0.0.RC3.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RC3/org.springframework.beans-sources-3.0.0.RC3.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RC3/org.springframework.context-3.0.0.RC3.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RC3/org.springframework.context-sources-3.0.0.RC3.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RC3/org.springframework.core-3.0.0.RC3.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RC3/org.springframework.core-sources-3.0.0.RC3.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.expression/3.0.0.RC3/org.springframework.expression-3.0.0.RC3.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.expression/3.0.0.RC3/org.springframework.expression-sources-3.0.0.RC3.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.transaction/3.0.0.RC3/org.springframework.transaction-3.0.0.RC3.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.transaction/3.0.0.RC3/org.springframework.transaction-sources-3.0.0.RC3.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.test/3.0.0.RC3/org.springframework.test-3.0.0.RC3.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.test/3.0.0.RC3/org.springframework.test-sources-3.0.0.RC3.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.aop/3.0.0.RELEASE/org.springframework.aop-3.0.0.RELEASE.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.aop/3.0.0.RELEASE/org.springframework.aop-sources-3.0.0.RELEASE.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.asm/3.0.0.RELEASE/org.springframework.asm-3.0.0.RELEASE.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.asm/3.0.0.RELEASE/org.springframework.asm-sources-3.0.0.RELEASE.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.expression/3.0.0.RELEASE/org.springframework.expression-3.0.0.RELEASE.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.expression/3.0.0.RELEASE/org.springframework.expression-sources-3.0.0.RELEASE.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.transaction/3.0.0.RELEASE/org.springframework.transaction-3.0.0.RELEASE.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.transaction/3.0.0.RELEASE/org.springframework.transaction-sources-3.0.0.RELEASE.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/org.springframework.test/3.0.0.RELEASE/org.springframework.test-3.0.0.RELEASE.jar" sourcepath="/IVY_CACHE/org.springframework/org.springframework.test/3.0.0.RELEASE/org.springframework.test-sources-3.0.0.RELEASE.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.mockito/com.springsource.org.mockito/1.8.0/com.springsource.org.mockito-1.8.0.jar" sourcepath="/IVY_CACHE/org.mockito/com.springsource.org.mockito/1.8.0/com.springsource.org.mockito-sources-1.8.0.jar" />
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.objenesis/com.springsource.org.objenesis/1.0.0/com.springsource.org.objenesis-1.0.0.jar" sourcepath="/IVY_CACHE/org.objenesis/com.springsource.org.objenesis/1.0.0/com.springsource.org.objenesis-sources-1.0.0.jar" />
|
||||
<classpathentry kind="output" path="target/classes" />
|
||||
|
||||
@@ -29,8 +29,8 @@ import org.springframework.expression.EvaluationException;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.ParseException;
|
||||
import org.springframework.expression.spel.SpelParserConfiguration;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParserConfiguration;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.integration.channel.ChannelResolver;
|
||||
import org.springframework.integration.channel.MessageChannelTemplate;
|
||||
@@ -55,9 +55,7 @@ public class MessagePublishingInterceptor implements MethodInterceptor {
|
||||
|
||||
private final ExpressionSource expressionSource;
|
||||
|
||||
private final ExpressionParser parser = new SpelExpressionParser(
|
||||
SpelExpressionParserConfiguration.CreateObjectIfAttemptToReferenceNull |
|
||||
SpelExpressionParserConfiguration.GrowListsOnIndexBeyondSize);
|
||||
private final ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
|
||||
|
||||
private volatile ChannelResolver channelResolver;
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.TypeDescriptor;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.core.convert.converter.ConverterRegistry;
|
||||
import org.springframework.core.convert.support.ConversionServiceFactory;
|
||||
@@ -331,7 +330,6 @@ public class ArgumentArrayMessageMapper implements InboundMessageMapper<Object[]
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object getValueFromMessageBasedOnEL(Message message, Class targetType, boolean rethrowException, String... expressions) {
|
||||
Object value = null;
|
||||
targetType = new TypeDescriptor(targetType).getObjectType(); //converts primitives to Object wrappers
|
||||
for (String expression : expressions) {
|
||||
StandardEvaluationContext context = new StandardEvaluationContext(message);
|
||||
context.setTypeConverter(new StandardTypeConverter(conversionService));
|
||||
@@ -339,7 +337,7 @@ public class ArgumentArrayMessageMapper implements InboundMessageMapper<Object[]
|
||||
Expression exp = expressionParser.parseExpression(expression);
|
||||
context.addPropertyAccessor(new MapAccessor());
|
||||
value = exp.getValue(context);
|
||||
if (value != null && this.canConvertToType(value, targetType)) {
|
||||
if (value != null && conversionService.canConvert(value.getClass(), targetType)) {
|
||||
// to accommodate Map->Properties conversion
|
||||
value = expression.equals("headers") ? conversionService.convert(value, targetType) : value;
|
||||
break;
|
||||
@@ -369,15 +367,6 @@ public class ArgumentArrayMessageMapper implements InboundMessageMapper<Object[]
|
||||
return parameterList;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private boolean canConvertToType(Object value, Class targetType) {
|
||||
if (value instanceof String && Map.class.isAssignableFrom(targetType)) {
|
||||
// to address payload String "foo=bar" mapping to Properties/Map
|
||||
return ((String) value).indexOf("=") > 0;
|
||||
}
|
||||
return conversionService.canConvert(value.getClass(), targetType);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void validateMessageMapppings(Message<?> message) {
|
||||
// Validate against a Map with no annotations
|
||||
|
||||
@@ -21,8 +21,8 @@ import org.springframework.expression.EvaluationException;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.ParseException;
|
||||
import org.springframework.expression.spel.SpelParserConfiguration;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParserConfiguration;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.message.MessageHandlingException;
|
||||
@@ -36,19 +36,13 @@ import org.springframework.integration.message.MessageHandlingException;
|
||||
*/
|
||||
public class ExpressionEvaluatingMessageProcessor implements MessageProcessor {
|
||||
|
||||
/*private final ExpressionParser parser = new SpelExpressionParser(
|
||||
SpelExpressionParserConfiguration.CreateObjectIfAttemptToReferenceNull |
|
||||
SpelExpressionParserConfiguration.GrowListsOnIndexBeyondSize);
|
||||
*/
|
||||
private final ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
|
||||
|
||||
private final Expression expression;
|
||||
|
||||
|
||||
public ExpressionEvaluatingMessageProcessor(String expression) {
|
||||
try {
|
||||
ExpressionParser parser = new SpelExpressionParser(
|
||||
SpelExpressionParserConfiguration.CreateObjectIfAttemptToReferenceNull |
|
||||
SpelExpressionParserConfiguration.GrowListsOnIndexBeyondSize);
|
||||
this.expression = parser.parseExpression(expression);
|
||||
}
|
||||
catch (ParseException e) {
|
||||
@@ -56,6 +50,7 @@ public class ExpressionEvaluatingMessageProcessor implements MessageProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Object processMessage(Message<?> message) {
|
||||
StandardEvaluationContext context = new StandardEvaluationContext(message);
|
||||
context.addPropertyAccessor(new MapAccessor());
|
||||
|
||||
Reference in New Issue
Block a user