I have 2 Mongodb databases connected to a Spring Boot app with 2 MongoTemplate-s:
mongoTemplate (the default bean name, connects to default db)
mongoAppTemplate (connects to another database on run-time)
I have a lot of MongoRepository-s that use mongoTemplate but I also want to create some that would use mongoAppTemplate.
How can I configure 2 MongoRepository-s to use different MongoTemplate -s with Java configuration ?
I found a way to do it with XML (link below), but I really want to keep it all annotation based
Spring-data-mongodb connect to multiple databases in one Mongo instance