Browse Source

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
pull/7/head
Chris Beams 14 years ago
parent
commit
1819bee35f
  1. 13
      org.springframework.aop/src/main/java/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.java
  2. 13
      org.springframework.context/src/main/java/org/springframework/cache/interceptor/CacheProxyFactoryBean.java
  3. 29
      org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/TransactionProxyFactoryBean.java

13
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; import org.springframework.util.ClassUtils;
/** /**
* Convenient superclass for proxy-creating * Convenient superclass for {@link FactoryBean} types that produce singleton-scoped
* {@link org.springframework.beans.factory.FactoryBean FactoryBean} types that produce * proxy objects.
* only singleton-scoped objects. *
*
* <p>Manages pre- and post-interceptors (references, rather than * <p>Manages pre- and post-interceptors (references, rather than
* interceptor names, as in {@link ProxyFactoryBean}) and provides * interceptor names, as in {@link ProxyFactoryBean}) and provides
* consistent interface management. * consistent interface management.
* *
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 2.0 * @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}&#042; annotations, e.g.
* {@code @EnableTransactionManagement}.
*/ */
@Deprecated
@SuppressWarnings("serial") @SuppressWarnings("serial")
public abstract class AbstractSingletonProxyFactoryBean extends ProxyConfig public abstract class AbstractSingletonProxyFactoryBean extends ProxyConfig
implements FactoryBean<Object>, BeanClassLoaderAware, InitializingBean { implements FactoryBean<Object>, BeanClassLoaderAware, InitializingBean {

13
org.springframework.context/src/main/java/org/springframework/cache/interceptor/CacheProxyFactoryBean.java vendored

@ -26,14 +26,19 @@ import org.springframework.aop.support.DefaultPointcutAdvisor;
* {@link org.springframework.aop.framework.ProxyFactoryBean} * {@link org.springframework.aop.framework.ProxyFactoryBean}
* with a separate {@link CachingInterceptor} definition. * with a separate {@link CachingInterceptor} definition.
* *
* <p>This class is intended to cover the <i>typical</i> case of declarative * <p>This class is designed to facilitate declarative cache demarcation: namely, wrapping
* cache demarcation: namely, wrapping a singleton target object with a * a singleton target object with a caching proxy, proxying all the interfaces that the
* caching proxy, proxying all the interfaces that the target implements. * target implements. Exists primarily for third-party framework integration.
* * <strong>Users should favor the {@code cache:} XML namespace
* {@link org.springframework.cache.annotation.Cacheable @Cacheable} annotation.</strong>
* See the <a href="http://bit.ly/p9rIvx">declarative annotation-based caching</a> section
* of the Spring reference documentation for more information.
*
* @author Costin Leau * @author Costin Leau
* @see org.springframework.aop.framework.ProxyFactoryBean * @see org.springframework.aop.framework.ProxyFactoryBean
* @see CachingInterceptor * @see CachingInterceptor
*/ */
@SuppressWarnings("serial")
public class CacheProxyFactoryBean extends AbstractSingletonProxyFactoryBean { public class CacheProxyFactoryBean extends AbstractSingletonProxyFactoryBean {
private final CacheInterceptor cachingInterceptor = new CacheInterceptor(); private final CacheInterceptor cachingInterceptor = new CacheInterceptor();

29
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} * {@link org.springframework.aop.framework.ProxyFactoryBean}
* with a separate {@link TransactionInterceptor} definition. * with a separate {@link TransactionInterceptor} definition.
* *
* <p><strong>HISTORICAL NOTE:</strong>This class was originally intended to cover the * <p><strong>HISTORICAL NOTE:</strong> This class was originally designed to cover the
* typical case of declarative * typical case of declarative transaction demarcation: namely, wrapping a singleton
* transaction demarcation: namely, wrapping a singleton target object with a * target object with a transactional proxy, proxying all the interfaces that the target
* transactional proxy, proxying all the interfaces that the target implements. However, * implements. However, in Spring versions 2.0 and beyond, the functionality provided here
* in Spring versions 2.0 and beyond, the functionality provided here is superseded * is superseded by the more convenient {@code tx:} XML namespace. See the <a
* by the more convenient {@code tx:} XML namespace. See the <a href="http://bit.ly/qUwvwz"> * href="http://bit.ly/qUwvwz">declarative transaction management</a> section of the
* declarative transaction management</a> section of the Spring reference documentation to * Spring reference documentation to understand the modern options for managing
* understand the modern options for managing transactions in Spring applications. * transactions in Spring applications. For these reasons, <strong>users should favor of
* <strong>While this class has been deprecated starting with Spring 3.1, its use remains * the {@code tx:} XML namespace as well as
* valid and supported</strong>. The deprecation serves as a strong reminder to users that * the @{@link org.springframework.transaction.annotation.Transactional Transactional}
* simpler and superior approaches are available. What follows is the original * and @{@link org.springframework.transaction.annotation.EnableTransactionManagement
* (pre-deprecation) documentation. * EnableTransactionManagement} annotations.</strong>
* *
* <p>There are three main properties that need to be specified: * <p>There are three main properties that need to be specified:
* <ul> * <ul>
@ -111,12 +111,7 @@ import org.springframework.transaction.PlatformTransactionManager;
* @see #setTransactionAttributes * @see #setTransactionAttributes
* @see TransactionInterceptor * @see TransactionInterceptor
* @see org.springframework.aop.framework.ProxyFactoryBean * @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") @SuppressWarnings("serial")
public class TransactionProxyFactoryBean extends AbstractSingletonProxyFactoryBean public class TransactionProxyFactoryBean extends AbstractSingletonProxyFactoryBean
implements BeanFactoryAware { implements BeanFactoryAware {

Loading…
Cancel
Save