Deprecate/move CGLIB methods AopUtils=>ClassUtils

isCglibProxy* methods in AopUtils are useful in lower-level modules,
i.e. those that cannot depend on .aop.  Therefore copied these methods
to ClassUtils; deprecated the existing ones in AopUtils and now
delegating to the new location; switched all usage of
AopUtils#isCglibProxy* within the framework to use
ClassUtils#isCglibProxy* instead.
This commit is contained in:
Chris Beams
2011-07-06 09:15:27 +00:00
parent 78b60947ad
commit 7c25c84ee2
5 changed files with 49 additions and 14 deletions

View File

@@ -21,7 +21,6 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.context.ApplicationContext;
@@ -29,6 +28,7 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.util.ClassUtils;
import test.beans.TestBean;
@@ -54,7 +54,7 @@ public class ImportedConfigurationClassEnhancementTests {
ApplicationContext ctx = new AnnotationConfigApplicationContext(configClasses);
Config config = ctx.getBean(Config.class);
assertTrue("autowired config class has not been enhanced",
AopUtils.isCglibProxyClass(config.autowiredConfig.getClass()));
ClassUtils.isCglibProxy(config.autowiredConfig));
}

View File

@@ -16,11 +16,11 @@
package org.springframework.context.annotation.configuration;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import org.springframework.aop.support.AopUtils;
import org.junit.Test;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
@@ -29,6 +29,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.ClassUtils;
public class Spr7167Tests {
@Test
@@ -40,7 +41,7 @@ public class Spr7167Tests {
equalTo("post processed by MyPostProcessor"));
MyConfig config = ctx.getBean(MyConfig.class);
assertTrue("Config class was not enhanced", AopUtils.isCglibProxyClass(config.getClass()));
assertTrue("Config class was not enhanced", ClassUtils.isCglibProxy(config));
}
}