Deprecate TransactionProxyFactoryBean
This commit is contained in:
parent
c85ebd9a5a
commit
2b371a7c9a
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2009 the original author or authors.
|
* Copyright 2002-2011 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -37,12 +37,13 @@ import org.springframework.util.ClassUtils;
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public abstract class AbstractSingletonProxyFactoryBean extends ProxyConfig
|
public abstract class AbstractSingletonProxyFactoryBean extends ProxyConfig
|
||||||
implements FactoryBean<Object>, BeanClassLoaderAware, InitializingBean {
|
implements FactoryBean<Object>, BeanClassLoaderAware, InitializingBean {
|
||||||
|
|
||||||
private Object target;
|
private Object target;
|
||||||
|
|
||||||
private Class[] proxyInterfaces;
|
private Class<?>[] proxyInterfaces;
|
||||||
|
|
||||||
private Object[] preInterceptors;
|
private Object[] preInterceptors;
|
||||||
|
|
||||||
|
|
@ -77,7 +78,7 @@ public abstract class AbstractSingletonProxyFactoryBean extends ProxyConfig
|
||||||
* out which interfaces need proxying by analyzing the target,
|
* out which interfaces need proxying by analyzing the target,
|
||||||
* proxying all the interfaces that the target object implements.
|
* proxying all the interfaces that the target object implements.
|
||||||
*/
|
*/
|
||||||
public void setProxyInterfaces(Class[] proxyInterfaces) {
|
public void setProxyInterfaces(Class<?>[] proxyInterfaces) {
|
||||||
this.proxyInterfaces = proxyInterfaces;
|
this.proxyInterfaces = proxyInterfaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package org.springframework.cache.interceptor;
|
package org.springframework.cache.interceptor;
|
||||||
|
|
||||||
import org.springframework.aop.Pointcut;
|
|
||||||
import org.springframework.aop.framework.AbstractSingletonProxyFactoryBean;
|
import org.springframework.aop.framework.AbstractSingletonProxyFactoryBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -26,17 +25,17 @@ import org.springframework.aop.framework.AbstractSingletonProxyFactoryBean;
|
||||||
* 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 intended to cover the <i>typical</i> case of declarative
|
||||||
* transaction demarcation: namely, wrapping a singleton target object with a
|
* caching: namely, wrapping a singleton target object with a caching proxy,
|
||||||
* caching proxy, proxying all the interfaces that the target implements.
|
* proxying all the interfaces that the target implements.
|
||||||
*
|
*
|
||||||
* @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();
|
||||||
private Pointcut pointcut;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object createMainInterceptor() {
|
protected Object createMainInterceptor() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2009 the original author or authors.
|
* Copyright 2002-2011 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -17,10 +17,8 @@
|
||||||
package org.springframework.context.support;
|
package org.springframework.context.support;
|
||||||
|
|
||||||
import org.springframework.aop.framework.AbstractSingletonProxyFactoryBean;
|
import org.springframework.aop.framework.AbstractSingletonProxyFactoryBean;
|
||||||
import org.springframework.beans.BeansException;
|
|
||||||
import org.springframework.beans.factory.BeanFactory;
|
import org.springframework.beans.factory.BeanFactory;
|
||||||
import org.springframework.beans.factory.BeanFactoryAware;
|
import org.springframework.beans.factory.BeanFactoryAware;
|
||||||
import org.springframework.beans.factory.FactoryBean;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class TestProxyFactoryBean extends AbstractSingletonProxyFactoryBean implements BeanFactoryAware {
|
public class TestProxyFactoryBean extends AbstractSingletonProxyFactoryBean implements BeanFactoryAware {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2009 the original author or authors.
|
* Copyright 2002-2011 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -33,9 +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>This class is intended to cover the <i>typical</i> case of declarative
|
* <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
|
* transaction demarcation: namely, wrapping a singleton target object with a
|
||||||
* transactional proxy, proxying all the interfaces that the target implements.
|
* 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>There are three main properties that need to be specified:
|
* <p>There are three main properties that need to be specified:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
|
@ -71,36 +80,44 @@ import org.springframework.transaction.PlatformTransactionManager;
|
||||||
* This reduces the per-bean definition effort to a minimum.
|
* This reduces the per-bean definition effort to a minimum.
|
||||||
*
|
*
|
||||||
* <pre code="class">
|
* <pre code="class">
|
||||||
* <bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
|
* {@code
|
||||||
* abstract="true">
|
* <bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
|
||||||
* <property name="transactionManager" ref="transactionManager"/>
|
* abstract="true">
|
||||||
* <property name="transactionAttributes">
|
* <property name="transactionManager" ref="transactionManager"/>
|
||||||
* <props>
|
* <property name="transactionAttributes">
|
||||||
* <prop key="insert*">PROPAGATION_REQUIRED</prop>
|
* <props>
|
||||||
* <prop key="update*">PROPAGATION_REQUIRED</prop>
|
* <prop key="insert*">PROPAGATION_REQUIRED</prop>
|
||||||
* <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
|
* <prop key="update*">PROPAGATION_REQUIRED</prop>
|
||||||
* </props>
|
* <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
|
||||||
* </property>
|
* </props>
|
||||||
* </bean>
|
* </property>
|
||||||
|
* </bean>
|
||||||
*
|
*
|
||||||
* <bean id="myProxy" parent="baseTransactionProxy">
|
* <bean id="myProxy" parent="baseTransactionProxy">
|
||||||
* <property name="target" ref="myTarget"/>
|
* <property name="target" ref="myTarget"/>
|
||||||
* </bean>
|
* </bean>
|
||||||
*
|
*
|
||||||
* <bean id="yourProxy" parent="baseTransactionProxy">
|
* <bean id="yourProxy" parent="baseTransactionProxy">
|
||||||
* <property name="target" ref="yourTarget"/>
|
* <property name="target" ref="yourTarget"/>
|
||||||
* </bean></pre>
|
* </bean>}</pre>
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @author Dmitriy Kopylenko
|
* @author Dmitriy Kopylenko
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
|
* @author Chris Beams
|
||||||
* @since 21.08.2003
|
* @since 21.08.2003
|
||||||
* @see #setTransactionManager
|
* @see #setTransactionManager
|
||||||
* @see #setTarget
|
* @see #setTarget
|
||||||
* @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")
|
||||||
public class TransactionProxyFactoryBean extends AbstractSingletonProxyFactoryBean
|
public class TransactionProxyFactoryBean extends AbstractSingletonProxyFactoryBean
|
||||||
implements BeanFactoryAware {
|
implements BeanFactoryAware {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue