8
8
import org .springframework .transaction .PlatformTransactionManager ;
9
9
import org .springframework .transaction .TransactionStatus ;
10
10
import org .springframework .transaction .support .DefaultTransactionDefinition ;
11
- import org .springframework .transaction .support .SimpleTransactionStatus ;
12
11
13
12
/**
14
13
* <p>
34
33
public class SpringTransactionHooks implements BeanFactoryAware {
35
34
36
35
private BeanFactory beanFactory ;
37
- private String txnManagerBeanName ;
38
36
39
37
@ Override
40
38
public void setBeanFactory (BeanFactory beanFactory ) throws BeansException {
41
39
this .beanFactory = beanFactory ;
42
40
}
43
41
44
- /**
45
- * @return the (optional) bean name for the transaction manager to be
46
- * obtained - if null, attempt will be made to find a transaction manager
47
- * by bean type
48
- */
49
- public String getTxnManagerBeanName () {
50
- return txnManagerBeanName ;
51
- }
52
-
53
- /**
54
- * Setter to allow (optional) bean name to be specified for transaction
55
- * manager bean - if null, attempt will be made to find a transaction manager
56
- * by bean type
57
- *
58
- * @param txnManagerBeanName bean name of transaction manager bean
59
- */
60
- public void setTxnManagerBeanName (String txnManagerBeanName ) {
61
- this .txnManagerBeanName = txnManagerBeanName ;
62
- }
63
-
64
42
private TransactionStatus transactionStatus ;
65
43
66
44
@ Before (value = "@txn" , order = 100 )
@@ -76,18 +54,6 @@ public void rollBackTransaction() {
76
54
}
77
55
78
56
public PlatformTransactionManager obtainPlatformTransactionManager () {
79
- if (txnManagerBeanName == null ) {
80
- return beanFactory .getBean (PlatformTransactionManager .class );
81
- } else {
82
- return beanFactory .getBean (txnManagerBeanName , PlatformTransactionManager .class );
83
- }
84
- }
85
-
86
- public TransactionStatus getTransactionStatus () {
87
- return transactionStatus ;
88
- }
89
-
90
- public void setTransactionStatus (SimpleTransactionStatus transactionStatus ) {
91
- this .transactionStatus = transactionStatus ;
57
+ return beanFactory .getBean (PlatformTransactionManager .class );
92
58
}
93
59
}
0 commit comments