I want to create an application with Java, Spring and Spring JPA with multiple databases on run time.
Actually i am creating multi-tenant application with following flow:
1- one Application may be php: from website user will create account, the system will run the process and will create database and respective configuration.
2- Major application ( Java + Spring JPA, Spring REST) will now loaded, start pointing to that newly created database which contains users and other stuff data may be on the basis of tenant Id or some other pointing flag.
Further Plan to add 3rd point; 3- oAuth2 rest security as well. so the configuration should be accordingly.
now the question is that how to achieve this in Spring Data JPA application and switch the database configuration on run time?