Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

MongoTemplate autowiring

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't for the life of me get my maven project to create my bean for mongoTemplate for Autowiring. Can someone help this poor soul of a programmer?
Here is the error I keep getting:


Here is the applicationContext that is stored in my src>main>resources>Meta-inf folder:



Below is the class that I am trying to autowire this bad boy in. Pretend that It says MongoTemplate instead of MongoOperations. I tried two ways...
one to autowire and the other to just get it through a context and neither are working:



I even tried to do a application config java class to get the mongotemplate set. Which explains the MongoOperations I was trying to use:


On last thing I was going to try but stopped because I didn't know how to set the host and all the stuff doing it this way:


^I looked at so many examples and still can't get this thing to autowire in so I can connect to my mongodb. If you have any questions please ask. I can autowire everything else in my project but I can't seem to get this mongoTemplate to follow suit.
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joseph,

It seems like you are trying to mix XML based configuration and Java based configuration which might be causing problems. I've never mixed and matched it like this. Can you try to declare MongoTemplate in XML and see if it solves the problem?

 
joseph Williams
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Application Context wasn't working for Jack so I just used a java bean class to get it to map correctly.
 
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!