From 1819bee35fcf7c00a48ba37010ebfb7c240b5403 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Sun, 9 Oct 2011 07:54:54 +0000 Subject: [PATCH] Revert deprecation of AbstractSingletonPFB and co Removed formal deprecation warnings for AbstractSingletonFactoryBean and its TransactionProxyFactoryBean and CacheProxyFactoryBean subclasses. This is principally because TPFB is still used by Grails and could conceivably be used to good effect by any third-party framework in a similar fashion. CPFB is new with 3.1, but similar use is predictable. Deprecations have been replaced by strong recommendations that users avoid these types in modern Spring applications and favor the use of namespaces and annotatinos, such as tx: and @Transactional (around since Spring 2.x) and cache: and @Cacheable. Issue: SPR-8680, SPR-8686 --- .../AbstractSingletonProxyFactoryBean.java | 13 ++------- .../interceptor/CacheProxyFactoryBean.java | 13 ++++++--- .../TransactionProxyFactoryBean.java | 29 ++++++++----------- 3 files changed, 24 insertions(+), 31 deletions(-) diff --git a/org.springframework.aop/src/main/java/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.java b/org.springframework.aop/src/main/java/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.java index cc0a9918897..18d8d25d153 100644 --- a/org.springframework.aop/src/main/java/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.java +++ b/org.springframework.aop/src/main/java/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.java @@ -27,23 +27,16 @@ import org.springframework.beans.factory.InitializingBean; import org.springframework.util.ClassUtils; /** - * Convenient superclass for proxy-creating - * {@link org.springframework.beans.factory.FactoryBean FactoryBean} types that produce - * only singleton-scoped objects. - * + * Convenient superclass for {@link FactoryBean} types that produce singleton-scoped + * proxy objects. + * *

Manages pre- and post-interceptors (references, rather than * interceptor names, as in {@link ProxyFactoryBean}) and provides * consistent interface management. * * @author Juergen Hoeller * @since 2.0 - * @deprecated as of Spring 3.1 following the deprecation of its only implementation - * ({@link org.springframework.transaction.interceptor.TransactionProxyFactoryBean - * TransactionProxyFactoryBean}) and generally in favor of providing such functionality - * via Spring XML namespaces, e.g. {@code tx:} or {@code @Enable}* annotations, e.g. - * {@code @EnableTransactionManagement}. */ -@Deprecated @SuppressWarnings("serial") public abstract class AbstractSingletonProxyFactoryBean extends ProxyConfig implements FactoryBean, BeanClassLoaderAware, InitializingBean { diff --git a/org.springframework.context/src/main/java/org/springframework/cache/interceptor/CacheProxyFactoryBean.java b/org.springframework.context/src/main/java/org/springframework/cache/interceptor/CacheProxyFactoryBean.java index 297f4db4df0..5504fe57566 100644 --- a/org.springframework.context/src/main/java/org/springframework/cache/interceptor/CacheProxyFactoryBean.java +++ b/org.springframework.context/src/main/java/org/springframework/cache/interceptor/CacheProxyFactoryBean.java @@ -26,14 +26,19 @@ import org.springframework.aop.support.DefaultPointcutAdvisor; * {@link org.springframework.aop.framework.ProxyFactoryBean} * with a separate {@link CachingInterceptor} definition. * - *

This class is intended to cover the typical case of declarative - * cache demarcation: namely, wrapping a singleton target object with a - * caching proxy, proxying all the interfaces that the target implements. - * + *

This class is designed to facilitate declarative cache demarcation: namely, wrapping + * a singleton target object with a caching proxy, proxying all the interfaces that the + * target implements. Exists primarily for third-party framework integration. + * Users should favor the {@code cache:} XML namespace + * {@link org.springframework.cache.annotation.Cacheable @Cacheable} annotation. + * See the declarative annotation-based caching section + * of the Spring reference documentation for more information. + * * @author Costin Leau * @see org.springframework.aop.framework.ProxyFactoryBean * @see CachingInterceptor */ +@SuppressWarnings("serial") public class CacheProxyFactoryBean extends AbstractSingletonProxyFactoryBean { private final CacheInterceptor cachingInterceptor = new CacheInterceptor(); diff --git a/org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/TransactionProxyFactoryBean.java b/org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/TransactionProxyFactoryBean.java index 20d5cdec886..fe7ab37bbea 100644 --- a/org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/TransactionProxyFactoryBean.java +++ b/org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/TransactionProxyFactoryBean.java @@ -33,18 +33,18 @@ import org.springframework.transaction.PlatformTransactionManager; * {@link org.springframework.aop.framework.ProxyFactoryBean} * with a separate {@link TransactionInterceptor} definition. * - *

HISTORICAL NOTE:This class was originally intended to cover the - * typical case of declarative - * transaction demarcation: namely, wrapping a singleton target object with a - * transactional proxy, proxying all the interfaces that the target implements. However, - * in Spring versions 2.0 and beyond, the functionality provided here is superseded - * by the more convenient {@code tx:} XML namespace. See the - * declarative transaction management section of the Spring reference documentation to - * understand the modern options for managing transactions in Spring applications. - * While this class has been deprecated starting with Spring 3.1, its use remains - * valid and supported. The deprecation serves as a strong reminder to users that - * simpler and superior approaches are available. What follows is the original - * (pre-deprecation) documentation. + *

HISTORICAL NOTE: This class was originally designed to cover the + * typical case of declarative transaction demarcation: namely, wrapping a singleton + * target object with a transactional proxy, proxying all the interfaces that the target + * implements. However, in Spring versions 2.0 and beyond, the functionality provided here + * is superseded by the more convenient {@code tx:} XML namespace. See the declarative transaction management section of the + * Spring reference documentation to understand the modern options for managing + * transactions in Spring applications. For these reasons, users should favor of + * the {@code tx:} XML namespace as well as + * the @{@link org.springframework.transaction.annotation.Transactional Transactional} + * and @{@link org.springframework.transaction.annotation.EnableTransactionManagement + * EnableTransactionManagement} annotations. * *

There are three main properties that need to be specified: *

    @@ -111,12 +111,7 @@ import org.springframework.transaction.PlatformTransactionManager; * @see #setTransactionAttributes * @see TransactionInterceptor * @see org.springframework.aop.framework.ProxyFactoryBean - * @deprecated as of Spring 3.1 in favor of the {@code tx:} XML namespace as well as the - * {@link org.springframework.transaction.annotation.Transactional @Transactional} and - * {@link org.springframework.transaction.annotation.EnableTransactionManagement @EnableTransactionManagement} - * annotations */ -@Deprecated @SuppressWarnings("serial") public class TransactionProxyFactoryBean extends AbstractSingletonProxyFactoryBean implements BeanFactoryAware {