<?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:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
mongoTemplate에 주입시키기 위해서 사용
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg ref="mongoDbFactory"/>
</bean>
MakeHttp 객체를 spring 에서 관리하기 위해서 등록 , 변수로 mongoTemplate 을 주입
<bean id="makeHttp" class="httpClient.MakeHttp">
<constructor-arg ref="mongoTemplate"></constructor-arg>
</bean>
mongoDbFactory 에 이름 , DB이름 , host , port , username , password 설정
<beans profile="default">
<mongo:db-factory id="mongoDbFactory" dbname="incatable" host="127.0.0.1" port="27017"
username="inca" password="1"/>
</beans>
</beans>
'개발자 > MongoDB' 카테고리의 다른 글
MongoDB aggregate 예제 ( sort, limit, skip) (0) | 2013.05.16 |
---|---|
MongoDB aggregate 기능이 없을시??? (0) | 2013.05.16 |
MongoDB DB server에 아이디 비번 인증없으면 접근못하게 설정하기. (0) | 2013.04.25 |
Spring + mongoDB select , save 기능 (0) | 2013.04.25 |
MongoDB database , collection 삭제 하기 (2) | 2013.04.25 |