I'm working on data migration from SQL Server to PostgreSQL. I'm planning to switch the data source using a feature toggle to reduce the migration risk. I've got good idea how to return appropriate DataSource based on the feature toggle from AbstractRoutingDataSource. How can I wire in the returned DataSource into my Jpa/Crud Repositories. The examples I've found online were only focused on Jpa or assumed multitenancy requirement. In other cases assumed that each data source is defined in separate package because of @EnableJpaRepositories - which from what I understand wouldn't work with AbstractRoutingDataSource.
This is a follow-up question to Spring Boot - dynamically choose datasource with different SQL flavours based on a feature toggle