INT-2526: Remove deprecations in Core after upgrade to Spring 3.1.1

* remove deprecated usage of ConversionServiceFactory.createDefaultConversionService()
* remove deprecated usage of AopUtils.isCglibProxyClass

JIRA: https://jira.springsource.org/browse/INT-2526
This commit is contained in:
Soby Chacko
2013-02-05 19:07:32 -05:00
committed by Gunnar Hillert
parent fd4fa6aa75
commit 05cd8e68c0
4 changed files with 14 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
@@ -22,6 +22,7 @@ import java.util.concurrent.atomic.AtomicReference;
import org.springframework.aop.support.AopUtils;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.ReflectionUtils.MethodCallback;
@@ -30,6 +31,7 @@ import org.springframework.util.ReflectionUtils.MethodCallback;
*
* @author Dave Syer
* @author Gunnar Hillert
* @author Soby Chacko
*
*/
abstract class AnnotationFinder {
@@ -46,13 +48,12 @@ abstract class AnnotationFinder {
return reference.get();
}
@SuppressWarnings("deprecation")
private static Class<?> getTargetClass(Object targetObject) {
Class<?> targetClass = targetObject.getClass();
if (AopUtils.isAopProxy(targetObject)) {
targetClass = AopUtils.getTargetClass(targetObject);
}
else if (AopUtils.isCglibProxyClass(targetClass)) {
else if (ClassUtils.isCglibProxyClass(targetClass)) {
Class<?> superClass = targetObject.getClass().getSuperclass();
if (!Object.class.equals(superClass)) {
targetClass = superClass;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2013 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.
@@ -19,7 +19,7 @@ package org.springframework.integration.router;
import java.util.Collection;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.MessageDeliveryException;
@@ -36,6 +36,7 @@ import org.springframework.jmx.export.annotation.ManagedResource;
* @author Mark Fisher
* @author Oleg Zhurakousky
* @author Gunnar Hillert
* @author Soby Chacko
*/
@ManagedResource
public abstract class AbstractMessageRouter extends AbstractMessageHandler {
@@ -100,10 +101,9 @@ public abstract class AbstractMessageRouter extends AbstractMessageHandler {
return this.messagingTemplate;
}
@SuppressWarnings("deprecation")
protected ConversionService getRequiredConversionService() {
if (this.getConversionService() == null) {
this.setConversionService(ConversionServiceFactory.createDefaultConversionService());
this.setConversionService(new DefaultConversionService());
}
return this.getConversionService();
}

View File

@@ -25,13 +25,14 @@ import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.expression.TypeConverter;
/**
* @author Dave Syer
* @author Oleg Zhurakousky
* @author Gary Russell
* @author Soby Chacko
*/
public class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware {
@@ -43,11 +44,10 @@ public class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware
private volatile ConversionService conversionService;
@SuppressWarnings("deprecation")
public BeanFactoryTypeConverter() {
synchronized (BeanFactoryTypeConverter.class) {
if (defaultConversionService == null) {
defaultConversionService = ConversionServiceFactory.createDefaultConversionService();
defaultConversionService = new DefaultConversionService();
}
}
this.conversionService = defaultConversionService;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
@@ -73,6 +73,7 @@ import org.springframework.util.StringUtils;
* @author Oleg Zhurakousky
* @author Dave Syer
* @author Gunnar Hillert
* @author Soby Chacko
*
* @since 2.0
*/
@@ -356,13 +357,12 @@ public class MessagingMethodInvokerHelper<T> extends AbstractExpressionEvaluator
return fallbackMethods;
}
@SuppressWarnings("deprecation")
private Class<?> getTargetClass(Object targetObject) {
Class<?> targetClass = targetObject.getClass();
if (AopUtils.isAopProxy(targetObject)) {
targetClass = AopUtils.getTargetClass(targetObject);
}
else if (AopUtils.isCglibProxyClass(targetClass)) {
else if (org.springframework.util.ClassUtils.isCglibProxyClass(targetClass)) {
Class<?> superClass = targetObject.getClass().getSuperclass();
if (!Object.class.equals(superClass)) {
targetClass = superClass;