File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
src/main/java/org/springframework/data/neo4j/core Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 9090import org .springframework .data .neo4j .core .mapping .SpringDataCypherDsl ;
9191import org .springframework .data .neo4j .core .mapping .callback .EventSupport ;
9292import org .springframework .data .neo4j .core .schema .TargetNode ;
93+ import org .springframework .data .neo4j .core .transaction .Neo4jTransactionManager ;
9394import org .springframework .data .neo4j .repository .NoResultException ;
9495import org .springframework .data .neo4j .repository .query .QueryFragments ;
9596import org .springframework .data .neo4j .repository .query .QueryFragmentsAndParameters ;
@@ -1100,8 +1101,10 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
11001101 this .renderer = Renderer .getRenderer (cypherDslConfiguration );
11011102 this .elementIdOrIdFunction = SpringDataCypherDsl .elementIdOrIdFunction .apply (cypherDslConfiguration .getDialect ());
11021103 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 );
11051108 }
11061109
11071110 // only used for the CDI configuration
Original file line number Diff line number Diff line change 6767import org .springframework .data .neo4j .core .mapping .SpringDataCypherDsl ;
6868import org .springframework .data .neo4j .core .mapping .callback .ReactiveEventSupport ;
6969import org .springframework .data .neo4j .core .schema .TargetNode ;
70+ import org .springframework .data .neo4j .core .transaction .ReactiveNeo4jTransactionManager ;
7071import org .springframework .data .neo4j .repository .query .QueryFragments ;
7172import org .springframework .data .neo4j .repository .query .QueryFragmentsAndParameters ;
7273import org .springframework .data .projection .ProjectionFactory ;
@@ -1181,8 +1182,10 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
11811182 this .renderer = Renderer .getRenderer (cypherDslConfiguration );
11821183 this .elementIdOrIdFunction = SpringDataCypherDsl .elementIdOrIdFunction .apply (cypherDslConfiguration .getDialect ());
11831184 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 );
11861189 }
11871190
11881191 @ Override
You can’t perform that action at this time.
0 commit comments