Skip to content

Commit

Permalink
fixing incompatibility with Spring 3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Lippert committed Feb 21, 2012
1 parent ac87348 commit aac89d9
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Member;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand All @@ -29,6 +27,7 @@

import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.inject.Provider;

import org.eclipse.core.resources.IMarker;
import org.eclipse.jdt.core.IJavaElement;
Expand All @@ -52,7 +51,7 @@
import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.ide.eclipse.beans.core.BeansCorePlugin;
import org.springframework.ide.eclipse.beans.core.autowire.IAutowireDependencyResolver;
import org.springframework.ide.eclipse.beans.core.autowire.internal.provider.InjectionMetadata.InjectedElement;
Expand Down Expand Up @@ -361,7 +360,7 @@ private Set<IInjectionMetadataProvider> createInjectionMetadataProviders() {
BeanDefinition beanDef = BeansModelUtils.getMergedBeanDefinition(bean, context);
if (beanDef.getPropertyValues().size() > 0) {
BeanWrapperImpl wrapper = new BeanWrapperImpl(true);
wrapper.setConversionService(ConversionServiceFactory.createDefaultConversionService());
wrapper.setConversionService(new DefaultConversionService());
wrapper.setWrappedInstance(provider);
for (PropertyValue pv : beanDef.getPropertyValues().getPropertyValueList()) {
if (wrapper.isWritableProperty(pv.getName())) {
Expand All @@ -384,7 +383,7 @@ private Set<IInjectionMetadataProvider> createInjectionMetadataProviders() {
BeanDefinition beanDef = BeansModelUtils.getMergedBeanDefinition(bean, context);
if (beanDef.getPropertyValues().size() > 0) {
BeanWrapperImpl wrapper = new BeanWrapperImpl(true);
wrapper.setConversionService(ConversionServiceFactory.createDefaultConversionService());
wrapper.setConversionService(new DefaultConversionService());
wrapper.setWrappedInstance(provider);
for (PropertyValue pv : beanDef.getPropertyValues().getPropertyValueList()) {
if (wrapper.isWritableProperty(pv.getName())) {
Expand Down Expand Up @@ -595,16 +594,11 @@ protected boolean matchesBeanName(String beanName, String candidateName) {
public void resolveDependency(DependencyDescriptor descriptor, Class<?> type, String beanName,
Set<String> autowiredBeanNames, TypeConverter typeConverter) {
descriptor.initParameterNameDiscovery(this.parameterNameDiscoverer);
if (descriptor.getDependencyType().equals(ObjectFactory.class)) {
type = Object.class;
Type fieldFile = descriptor.getGenericDependencyType();
if (fieldFile instanceof ParameterizedType) {
Type arg = ((ParameterizedType) fieldFile).getActualTypeArguments()[0];
if (arg instanceof Class<?>) {
type = (Class<?>) arg;
}
}
if (descriptor.getDependencyType().equals(ObjectFactory.class) || descriptor.getDependencyType().equals(Provider.class)) {
descriptor.increaseNestingLevel();
type = descriptor.getDependencyType();
}

try {
doResolveDependency(descriptor, type, beanName, autowiredBeanNames, typeConverter);
}
Expand Down

0 comments on commit aac89d9

Please sign in to comment.