|
1 | 1 | package com.arangodb.springframework.transaction; |
2 | 2 |
|
3 | | -import com.arangodb.springframework.core.ArangoOperations; |
4 | | -import com.arangodb.springframework.repository.query.QueryTransactionBridge; |
| 3 | +import org.springframework.beans.factory.annotation.Autowired; |
5 | 4 | import org.springframework.context.annotation.Bean; |
6 | 5 | import org.springframework.transaction.PlatformTransactionManager; |
7 | 6 | import org.springframework.transaction.annotation.TransactionManagementConfigurer; |
8 | 7 |
|
| 8 | +import com.arangodb.springframework.core.ArangoOperations; |
| 9 | +import com.arangodb.springframework.repository.query.QueryTransactionBridge; |
| 10 | + |
| 11 | +/** |
| 12 | + * To enable stream transactions for Arango Spring Data, create a |
| 13 | + * {@link org.springframework.context.annotation.Configuration} class annotated with |
| 14 | + * {@link org.springframework.transaction.annotation.EnableTransactionManagement} and |
| 15 | + * {@link org.springframework.context.annotation.Import} this one. |
| 16 | + */ |
9 | 17 | public class ArangoTransactionManagementConfigurer implements TransactionManagementConfigurer { |
10 | 18 |
|
11 | | - private final ArangoOperations operations; |
12 | | - private final QueryTransactionBridge bridge; |
13 | | - |
14 | | - public ArangoTransactionManagementConfigurer(ArangoOperations operations, QueryTransactionBridge bridge) { |
15 | | - this.operations = operations; |
16 | | - this.bridge = bridge; |
17 | | - } |
| 19 | + @Autowired |
| 20 | + private ArangoOperations operations; |
| 21 | + private final QueryTransactionBridge bridge = new QueryTransactionBridge(); |
18 | 22 |
|
19 | 23 | @Override |
20 | | - @Bean |
21 | 24 | public PlatformTransactionManager annotationDrivenTransactionManager() { |
22 | 25 | return new ArangoTransactionManager(operations, bridge); |
23 | 26 | } |
| 27 | + |
| 28 | + @Bean |
| 29 | + QueryTransactionBridge arangoQueryTransactionBridge() { |
| 30 | + return bridge; |
| 31 | + } |
24 | 32 | } |
0 commit comments