INT-1551 replaced SimpleBeanResolver with BeanFactoryResolver. SimpleBeanResolver was a stop-gap solution and has now been removed.

This commit is contained in:
Mark Fisher
2010-10-28 11:44:38 -04:00
parent f4f9484d18
commit 8fc29ea855
4 changed files with 6 additions and 49 deletions

View File

@@ -25,6 +25,7 @@ import java.util.Map;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.context.expression.BeanFactoryResolver;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.MethodParameter;
import org.springframework.core.ParameterNameDiscoverer;
@@ -39,7 +40,6 @@ import org.springframework.integration.annotation.Headers;
import org.springframework.integration.annotation.Payload;
import org.springframework.integration.mapping.InboundMessageMapper;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.util.SimpleBeanResolver;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@@ -106,7 +106,7 @@ class GatewayMethodInboundMessageMapper implements InboundMessageMapper<Object[]
public void setBeanFactory(final BeanFactory beanFactory) {
if (beanFactory != null) {
this.beanResolver = new SimpleBeanResolver(beanFactory);
this.beanResolver = new BeanFactoryResolver(beanFactory);
this.evaluationContext.setBeanResolver(beanResolver);
}
}

View File

@@ -15,6 +15,7 @@ package org.springframework.integration.util;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.context.expression.BeanFactoryResolver;
import org.springframework.context.expression.MapAccessor;
import org.springframework.core.convert.ConversionService;
import org.springframework.expression.EvaluationException;
@@ -50,7 +51,7 @@ public abstract class AbstractExpressionEvaluator implements BeanFactoryAware {
public void setBeanFactory(final BeanFactory beanFactory) {
if (beanFactory != null) {
this.typeConverter.setBeanFactory(beanFactory);
this.evaluationContext.setBeanResolver(new SimpleBeanResolver(beanFactory));
this.evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
}
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.util;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.expression.AccessException;
import org.springframework.expression.BeanResolver;
import org.springframework.expression.EvaluationContext;
import org.springframework.util.Assert;
/**
* @author Mark Fisher
* @since 2.0
*/
public class SimpleBeanResolver implements BeanResolver {
private final BeanFactory beanFactory;
public SimpleBeanResolver(BeanFactory beanFactory) {
Assert.notNull(beanFactory, "beanFactory must not be null");
this.beanFactory = beanFactory;
}
public final Object resolve(EvaluationContext context, String beanName) throws AccessException {
return this.beanFactory.getBean(beanName);
}
}

View File

@@ -27,6 +27,7 @@ import java.util.Map;
import javax.xml.transform.Source;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.expression.BeanFactoryResolver;
import org.springframework.core.convert.ConversionService;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
@@ -47,7 +48,6 @@ import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
import org.springframework.integration.mapping.HeaderMapper;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.util.SimpleBeanResolver;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap;
@@ -202,7 +202,7 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
super.onInit();
BeanFactory beanFactory = this.getBeanFactory();
if (beanFactory != null) {
this.evaluationContext.setBeanResolver(new SimpleBeanResolver(beanFactory));
this.evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
}
ConversionService conversionService = this.getConversionService();
if (conversionService != null) {