File tree 2 files changed +10
-4
lines changed
src/main/java/org/springframework/data/neo4j/core
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 90
90
import org .springframework .data .neo4j .core .mapping .SpringDataCypherDsl ;
91
91
import org .springframework .data .neo4j .core .mapping .callback .EventSupport ;
92
92
import org .springframework .data .neo4j .core .schema .TargetNode ;
93
+ import org .springframework .data .neo4j .core .transaction .Neo4jTransactionManager ;
93
94
import org .springframework .data .neo4j .repository .NoResultException ;
94
95
import org .springframework .data .neo4j .repository .query .QueryFragments ;
95
96
import org .springframework .data .neo4j .repository .query .QueryFragmentsAndParameters ;
@@ -1100,8 +1101,10 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
1100
1101
this .renderer = Renderer .getRenderer (cypherDslConfiguration );
1101
1102
this .elementIdOrIdFunction = SpringDataCypherDsl .elementIdOrIdFunction .apply (cypherDslConfiguration .getDialect ());
1102
1103
this .cypherGenerator .setElementIdOrIdFunction (elementIdOrIdFunction );
1103
- this .transactionTemplate = new TransactionTemplate (beanFactory .getBean (PlatformTransactionManager .class ));
1104
- this .transactionTemplateReadOnly = new TransactionTemplate (beanFactory .getBean (PlatformTransactionManager .class ), readOnlyTransactionDefinition );
1104
+
1105
+ PlatformTransactionManager transactionManager = beanFactory .getBeanProvider (PlatformTransactionManager .class ).getIfUnique (() -> beanFactory .getBean (Neo4jTransactionManager .class ));
1106
+ this .transactionTemplate = new TransactionTemplate (transactionManager );
1107
+ this .transactionTemplateReadOnly = new TransactionTemplate (transactionManager , readOnlyTransactionDefinition );
1105
1108
}
1106
1109
1107
1110
// only used for the CDI configuration
Original file line number Diff line number Diff line change 67
67
import org .springframework .data .neo4j .core .mapping .SpringDataCypherDsl ;
68
68
import org .springframework .data .neo4j .core .mapping .callback .ReactiveEventSupport ;
69
69
import org .springframework .data .neo4j .core .schema .TargetNode ;
70
+ import org .springframework .data .neo4j .core .transaction .ReactiveNeo4jTransactionManager ;
70
71
import org .springframework .data .neo4j .repository .query .QueryFragments ;
71
72
import org .springframework .data .neo4j .repository .query .QueryFragmentsAndParameters ;
72
73
import org .springframework .data .projection .ProjectionFactory ;
@@ -1181,8 +1182,10 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
1181
1182
this .renderer = Renderer .getRenderer (cypherDslConfiguration );
1182
1183
this .elementIdOrIdFunction = SpringDataCypherDsl .elementIdOrIdFunction .apply (cypherDslConfiguration .getDialect ());
1183
1184
this .cypherGenerator .setElementIdOrIdFunction (elementIdOrIdFunction );
1184
- this .transactionalOperatorReadOnly = TransactionalOperator .create (beanFactory .getBean (ReactiveTransactionManager .class ), readOnlyTransactionDefinition );
1185
- this .transactionalOperator = TransactionalOperator .create (beanFactory .getBean (ReactiveTransactionManager .class ));
1185
+ ReactiveTransactionManager reactiveTransactionManager = beanFactory .getBeanProvider (ReactiveTransactionManager .class )
1186
+ .getIfUnique (() -> beanFactory .getBean (ReactiveNeo4jTransactionManager .class ));
1187
+ this .transactionalOperatorReadOnly = TransactionalOperator .create (reactiveTransactionManager , readOnlyTransactionDefinition );
1188
+ this .transactionalOperator = TransactionalOperator .create (reactiveTransactionManager );
1186
1189
}
1187
1190
1188
1191
@ Override
You can’t perform that action at this time.
0 commit comments