Since I want to use different databases in different scenarios, I want to use AbstractRoutingDatasource. However, I could not find an appropriate setting in which I can use both AbstractRoutingDatasource and Spring Data Neo4j (e.g., using @Transactional and automatic session injection). How can I do that?
AbstractRoutingDatasource is not supported by Neo4j, it's JDBC specific.
Here is one possible solution to implement what you want:
Please let me know, if that helps.
The solution can be used if we have a constant number of databases. In our application, the databases may be added or deleted. What can be done in such an application?
That's a case for using Neo4j Causual Cluster, which is available in Enterprise edition.
The Bolt driver has dedicated routing support through the
bolt+routing protocol, which does exactly that.
It seems that causal clustering is for having redundancy in data storage and being able answer more requests. What I need here is different databases, each having its own independent data. Something similar to
AbstractRoutingDatasource or the solution you proposed in the previous post but with dynamic databases (databases being added and removed).
Sorry, but it seems I cannot help you on that. However, an upcoming Neo4j version will support multiple databases per instance.
Can't your proposed solution be extended to support dynamic databases?