-
Notifications
You must be signed in to change notification settings - Fork 0
/
TransactionConfiguration.java
40 lines (34 loc) · 1.47 KB
/
TransactionConfiguration.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.example.demo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionException;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.support.AbstractPlatformTransactionManager;
import org.springframework.transaction.support.DefaultTransactionStatus;
@Configuration(proxyBeanMethods = false)
@EnableTransactionManagement
public class TransactionConfiguration {
@Bean
public PlatformTransactionManager dummyTransactionManager() {
return new AbstractPlatformTransactionManager() {
@Override
protected Object doGetTransaction() throws TransactionException {
return new Object();
}
@Override
protected void doBegin(Object transaction, TransactionDefinition definition) throws TransactionException {
// do nothing
}
@Override
protected void doCommit(DefaultTransactionStatus status) throws TransactionException {
// do nothing
}
@Override
protected void doRollback(DefaultTransactionStatus status) throws TransactionException {
// do nothing
}
};
}
}