Currently working on a project where my Spring Boot project needs to leverage multiple data sources or schema in the same DB server. I have found several tutorials that te
Managed to resolve the issue by using https://github.com/wmeints/spring-multi-tenant-demo.
Thanks @surya for your recommendation.
You need to look at AbstractRoutingDataSource and use it.
So if I need to search for User John Doe I have to go through Schema 1 and if I don't find him, move onto the next schema.
Thus you need to search in first schema and if not found, then go on to next schema.
In that example as given in the above link,
CustomerContextHolder.setCustomerType(CustomerType.GOLD);
List<Item> items = catalog.getItems();
if(isEmpty(goldItems)){
CustomerContextHolder.setCustomerType(CustomerType.SILVER);
items = catalog.getItems();
}
More details can be found in another qn here