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; @@ -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.
*
* <p>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}&#042; annotations, e.g.
* {@code @EnableTransactionManagement}.
*/
@Deprecated
@SuppressWarnings("serial")
public abstract class AbstractSingletonProxyFactoryBean extends ProxyConfig
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; @@ -26,14 +26,19 @@ import org.springframework.aop.support.DefaultPointcutAdvisor;
* {@link org.springframework.aop.framework.ProxyFactoryBean}
* with a separate {@link CachingInterceptor} definition.
*
* <p>This class is intended to cover the <i>typical</i> case of declarative
* cache demarcation: namely, wrapping a singleton target object with a
* caching proxy, proxying all the interfaces that the target implements.
*
* <p>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.
* <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
* @see org.springframework.aop.framework.ProxyFactoryBean
* @see CachingInterceptor
*/
@SuppressWarnings("serial")
public class CacheProxyFactoryBean extends AbstractSingletonProxyFactoryBean {
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; @@ -33,18 +33,18 @@ import org.springframework.transaction.PlatformTransactionManager;
* {@link org.springframework.aop.framework.ProxyFactoryBean}
* with a separate {@link TransactionInterceptor} definition.
*
* <p><strong>HISTORICAL NOTE:</strong>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 <a href="http://bit.ly/qUwvwz">
* declarative transaction management</a> section of the Spring reference documentation to
* understand the modern options for managing transactions in Spring applications.
* <strong>While this class has been deprecated starting with Spring 3.1, its use remains
* valid and supported</strong>. The deprecation serves as a strong reminder to users that
* simpler and superior approaches are available. What follows is the original
* (pre-deprecation) documentation.
* <p><strong>HISTORICAL NOTE:</strong> 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 <a
* href="http://bit.ly/qUwvwz">declarative transaction management</a> section of the
* Spring reference documentation to understand the modern options for managing
* transactions in Spring applications. For these reasons, <strong>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.</strong>
*
* <p>There are three main properties that need to be specified:
* <ul>
@ -111,12 +111,7 @@ import org.springframework.transaction.PlatformTransactionManager; @@ -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 {

Loading…
Cancel
Save