I switched to the github mongo schema and i currently use spring-data-mongodb-1.0.0.BUILD-20110404.083159-213.jar
Can you give me a little example using the xml Konfiguration?
My current context.xml is at the bottom, but with this some of my tests fail.
I couldn't pass the converter to the mongotemplate as constructor argumennt, but as simple property.
I assumed that the base package of converter should be the one of my domain classes,
not of the repositories. I couldn't find any Documentation for that.
Thank you very much
Code:
<?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:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:sec="http://www.springframework.org/schema/security" xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://www.springframework.org/schema/data/mongo https://github.com/SpringSource/spring-data-document/raw/master/spring-data-mongodb/src/main/resources/org/springframework/data/document/mongodb/config/spring-mongo-1.0.xsd">
<!--
http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
-->
<context:annotation-config />
<context:component-scan base-package="com...." />
<mongo:mongo id="mongo" host="${mongo.host}" port="27017">
<mongo:options autoConnectRetry="true" connectionsPerHost="10" threadsAllowedToBlockForConnectionMultiplier="5" maxWaitTime="12000" />
</mongo:mongo>
<mongo:repositories base-package="com.....repositories" mongo-template-ref="mongoTemplate" />
<bean id="mongoTemplate" class="org.springframework.data.document.mongodb.MongoTemplate">
<constructor-arg name="mongo" ref="mongo" />
<constructor-arg name="databaseName" value="${mongo.database}" />
<constructor-arg name="defaultCollectionName" value="${mongo.collection}" />
<property name="converter" ref="converter" />
</bean>
<mongo:mapping-converter
id="converter" mongo-ref="mongo"
mongo-template-ref="mongoTemplate" base-package="com.....domain"
/>
<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
</beans>