Add Depdendency to POM
<dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-mongodb</artifactId> <version>3.0.3.RELEASE</version> </dependency>
Define XML
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mongo="http://www.springframework.org/schema/data/mongo" xsi:schemaLocation= " http://www.springframework.org/schema/data/mongo https://www.springframework.org/schema/data/mongo/spring-mongo.xsd http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring https://camel.apache.org/schema/spring/camel-spring-2.23.3.xsd"> <!-- Default bean name is 'mongo' --> <mongo:mongo-client id="mongoClient" host="localhost" port="27017"/> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <route id="_route2"> <from id="_to1" uri="timer:timertimerName?period=3600000"/> <setBody id="_setBody1q"> <constant>{"item" : "card", "qty" : 99}</constant> </setBody> <to id="_to2" uri="mongodb:mongoClient?collection=mycollection&database=sample&operation=insert"/> </route> </camelContext>
</beans>