<?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"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:util="http://www.springframework.org/schema/util"
	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://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd
		http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

	<context:property-placeholder
			location="classpath:/org/springframework/data/mongodb/config/mongo.properties"/>

	<mongo:mongo-client host="${mongo.host}" port="${mongo.port}">

		<mongo:client-settings socket-read-timeout="${mongo.socketTimeout}"
							  />
	</mongo:mongo-client>
	
	<mongo:db-factory dbname="database" mongo-client-ref="mongoClient"/>

	<mongo:mongo-client id="mongoClientSsl">
		<mongo:client-settings ssl-enabled="${mongoSsl.ssl}" />
	</mongo:mongo-client>

	<mongo:db-factory id="secondMongoDbFactory"
					  dbname="database" />
					  
		<mongo:db-factory id="thirdMongoDbFactory"
					  dbname="database" />

	<mongo:mongo-client id="defaultMongo" host="localhost" port="27017"/>

	<mongo:mongo-client id="mongoSsl" host="localhost" port="27017">
		<mongo:client-settings ssl-enabled="${mongoSsl.ssl}"/>
	</mongo:mongo-client>

	<mongo:mongo-client id="mongoSslWithCustomSslFactory" host="localhost" port="27017">
		<!-- setting a non-null ssl-socket-factory implicitly sets ssl=true -->
		<mongo:client-settings ssl-enabled="true" ssl-provider="Default"/>
	</mongo:mongo-client>

	<mongo:mongo-client id="noAttrMongo"/>

	<mongo:mapping-converter>
		<mongo:custom-converters>
			<mongo:converter ref="readConverter"/>
			<mongo:converter>
				<bean class="org.springframework.data.mongodb.core.PersonWriteConverter"/>
			</mongo:converter>
		</mongo:custom-converters>
	</mongo:mapping-converter>

	<bean id="readConverter" class="org.springframework.data.mongodb.core.PersonReadConverter"/>

	<mongo:template id="mongoTemplate" db-factory-ref="mongoDbFactory" converter-ref="mappingConverter"/>
	<mongo:template id="anotherMongoTemplate" db-factory-ref="mongoDbFactory" write-concern="ACKNOWLEDGED" />
	
	<mongo:gridFsTemplate/>
	<mongo:gridFsTemplate id="secondGridFsTemplate" db-factory-ref="mongoDbFactory" converter-ref="mappingConverter"/>
	<mongo:gridFsTemplate id="thirdGridFsTemplate" db-factory-ref="mongoDbFactory" converter-ref="mappingConverter" bucket="bucketString"/>
	
</beans>
