2

I am using spring data r2dbc in my new project and need to connect multiple data sources like A data source and B data source. Is there a way to connect multiple data sources using r2dbc? Could I get an example or a document if there is a way?

My stacks are below:

  • Spring Boot 2.3.0.M4
  • Spring WebFlux
  • Spring Data R2DBC

2 Answers 2

6

If you want to use multiple datasources in a single application, check my multi r2dbc connection factories example.

If you need a multi-tenant like feature check this multi-tenancy-r2dbc example.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your answering They will be helpful :)
0

I solved this issue using AbstractRoutingConnectionFactory you can check Add support for AbstractRoutingConnectionFactory

2 Comments

Any more details on this solution? Can you point specific repos or entities different database connections?
@Eric check my complete multi-tenancy-r2dbc example in my answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.