I just started learning spring and mongoDb integration, but I didn't catch how the configuration should look properly.
I use official spring docs using java config examples.
here in section 9.3 is said that I can init MongoFactoryBean
and then use it throw @Autowired
annotation.
But then in section 9.3.4 we see initialization of beans using new Mongo()
.
Question: can I use '@Autowired Mongo mongo' in case of new Mongo()
? And should I have two separate configurations or I use configuration like in section 9.4.1.
Can someone explain me in easier words how to make configuration?