I have a spring-boot application with one database. Now I would like to integrate the possibility to copy some data from this database to another database. The connection to the second database should be done during runtime. I insert in my frontend the second database connection and start the copy from the first database to the second. The two databases have the same tables and I would like to use the same repositories. Is it possible to do that? If yes, do you know some code example or documentation? I'm trying to find the correct approach to do that.
Thank you!
Alternative solution could be to use AbstractRoutingDatasource: https://www.baeldung.com/spring-abstract-routing-data-source