title: How do I change database connection at runtime by changing only db url in hibernate's configuration in spring boot?
body: <p>I am developing a Spring Boot application that uses Spring Data JPA and will need to connect to only url different but other all same database e.g. jdbc:sqlite:db1.db jdbc:sqlite:db2.db I need to create all datasources in runtime . I read a lot of things about it in stack and spring forums(e.g. AbstractRoutingDataSource) but all of these tutorials show how to create datasources from .properties configuration or static definition in java bean. It is possible to create many datsources in runtime? How to manage transactions and how to create many sessionFactories? It is possible to use @Transactional annotation? What is the best method to do this? Can someone explain me how to do this 'step by step'?</p>