Skip to content

Instantly share code, notes, and snippets.

@lazaropj
Created October 21, 2013 22:29
Show Gist options
  • Save lazaropj/7092036 to your computer and use it in GitHub Desktop.
Save lazaropj/7092036 to your computer and use it in GitHub Desktop.
<?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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<context:component-scan base-package="br.com.linkout.crudNosql" />
<bean id="mongo" class="org.springframework.data.mongodb.core.MongoFactoryBean">
<property name="host"
value="mongodb://crud_mongo:[email protected]:63287/crud_mongo" />
</bean>
<bean id="mongoCredentials" class="org.springframework.data.authentication.UserCredentials">
<constructor-arg name="username" value="lazaropj" />
<constructor-arg name="password" value="hoje2013" />
</bean>
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg name="mongo" ref="mongo" />
<constructor-arg name="databaseName" value="crud_mongo" />
<constructor-arg name="userCredentials" ref="mongoCredentials" />
</bean>
<!-- Use this post processor to translate any MongoExceptions thrown in
@Repository annotated classes -->
<bean
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
</beans>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment