<mongo:db-factory id="mongoDbFactory" dbname="test" mongo-ref="mongo"/> <mongo:mongo-client host="127.0.0.1" port="27017"/> <mongo:mapping-converter id="mongoConverter" base-package="mongo"/> <mongo:repositories base-package="sample.repository" /> <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"> <constructor-arg ref="mongoDbFactory" /> <constructor-arg ref="mongoConverter" /> <property name="writeConcern" value="SAFE" /> </bean>
단위테스트(JUnit Test)
src/test/java/junit 아래의 자바파일로 단위테스트 실행.
Customer, ChildCustomer 를 이용한 CRUD 테스트