All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.smallmind.persistence.morphia.xml Maven / Gradle / Ivy

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">

  <!-- Collect Spring Initialized Morphia Resources -->
  <bean class="org.smallmind.persistence.orm.spring.morphia.FileSeekingBeanFactoryPostProcessor"/>

  <bean id="mongoClient" class="org.smallmind.persistence.database.mongodb.MongoClientFactoryBean">
    <property name="servers">
      <bean class="org.smallmind.persistence.database.mongodb.MongoServerFactoryBean">
        <property name="serverPattern" value="${mongo.server_pattern}"/>
        <property name="serverSpread" value="${mongo.server_spread}"/>
      </bean>
    </property>
    <property name="databases">
      <list>
        <bean class="org.smallmind.persistence.database.mongodb.MongoDatabase">
          <property name="user" value="${mongo.user}"/>
          <property name="password" value="${mongo.password}"/>
          <property name="database" value="mydatabase"/>
        </bean>
      </list>
    </property>
    <property name="clientOptions">
      <bean class="org.smallmind.persistence.database.mongodb.MongoClientOptionsFactoryBean">
        <property name="connectionsPerHost" value="100"/>
        <property name="threadsAllowedToBlockForConnectionMultiplier" value="5"/>
      </bean>
    </property>
  </bean>

  <bean id="dataStoreFactory" class="org.smallmind.persistence.orm.spring.morphia.FileSeekingDatastoreFactoryBean">
    <property name="mongoClient" ref="mongoClient"/>
    <property name="databaseName" value="mydatabase"/>
    <property name="sessionSourceKey" value="mysession"/>
  </bean>

  <!-- Proxy Session -->
  <bean id="morphiaProxySession" class="org.smallmind.persistence.orm.morphia.MorphiaProxySession" init-method="register">
    <constructor-arg index="0" value="mongodb"/>
    <constructor-arg index="1" value="mysession"/>
    <constructor-arg index="2" ref="dataStoreFactory"/>
    <constructor-arg index="3" value="true"/>
    <constructor-arg index="4" value="false"/>
  </bean>

</beans>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy