xml
version=
"1.0"
encoding=
"UTF-8"
?>
<
beans
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:p=
"http://www.springframework.org/schema/p"
xmlns:context=
"http://www.springframework.org/schema/context"
xmlns:aop=
"http://www.springframework.org/schema/aop"
xmlns:tx=
"http://www.springframework.org/schema/tx"
xmlns:cache=
"http://www.springframework.org/schema/cache"
xmlns:task=
"http://www.springframework.org/schema/task"
xmlns:jms=
"http://www.springframework.org/schema/jms"
xmlns:core=
"http://activemq.apache.org/schema/core"
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-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.3.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.xsd
http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-4.3.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.8.0.xsd
http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.8.xsd
http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository-1.8.xsd "
>
<
context:component-scan
base-package=
"com.code.mongdb.model"
/>
<
context:component-scan
base-package=
"com.code.mongdb.dao"
/>
<
context:component-scan
base-package=
"com.code.mongdb.service"
/>
<
bean
id=
"propertyConfigurer"
class=
"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
<
property
name=
"locations"
>
<
list
>
<
value
>mongo.properties
value
>
list
>
property
>
bean
>
id=
"mongoClient"
host=
"${mongo.host}"
port=
"${mongo.port}"
credentials=
"${mongo.username}:${mongo.password}@${mongo.dbname}">
write-concern=
"SAFE"
connections-per-host=
"${mongo.connectionsPerHost}"
threads-allowed-to-block-for-connection-multiplier=
"${mongo.threadsAllowedToBlockForConnectionMultiplier}"
connect-timeout=
"${mongo.connectTimeout}"
max-wait-time=
"${mongo.maxWaitTime}"
socket-timeout=
"${mongo.socketTimeout}"
/>
<
mongo:db-factory
id=
"mongoDbFactory"
dbname=
"${mongo.dbname}"
mongo-ref=
"mongoClient"
/>
<
bean
id=
"mongoTemplate"
class=
"org.springframework.data.mongodb.core.MongoTemplate"
>
<
constructor-arg
name=
"mongoDbFactory"
ref=
"mongoDbFactory"
/>
bean
>
beans
>