As of I know the spring-data library allows one MongoTemplate bean mapped to one Mongo database.
So if I need multiple database connections, I will have to define multiple MongoTemplate beans in config file.
In my application, new projects get added runtime so the respective Mongo databases. Hence it is not possible for me to maintain those connections in configuration file.
Is there any way to dynamically configure databases MongoTemplate.
I have gone through below solution suggested on most of the questions:
https://github.com/Loki-Afro/multi-tenant-spring-mongodb
But I am not quite convinced with this. Is there any way around ?