There are multiple problems in this example, which can be corrected as follows
add
@Service
anotation to yourshoponway.webservice.services.PersonService
class, you need to add@Service
for making it a proper candidate for injection.Your 'mongo-config.xml' is pointing to wrong mongo repository locations edit it to
<mongo:repositories base-package="shoponway.webservice.services" />
from
<mongo:repositories base-package="org.krams.tutorial.repositories" />
Mongo template should refer to following bean
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
not withclass="org.springframework.data.document.mongodb.MongoTemplate"
4) replace mongo-config.xml content with
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/data/mongo
http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<mongo:mongo host="localhost" port="27017" />
<mongo:db-factory dbname="shoponwaydb" />
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
</bean>
</beans>
`
Once your correct these , you will be able to run your example easily: