2

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?

Edgar
  • 1,120
  • 4
  • 28
  • 53
  • You can find here similar discussion http://stackoverflow.com/questions/21629500/difference-between-mongofactorybean-and-simplemongodbfactory – Hatice Jan 18 '16 at 09:59

0 Answers0