mongotemple

通过spring-data-mongodb 操作mongodb

北慕城南 提交于 2019-11-30 21:09:33
一、前言 其实,以前项目组也使用过mongodb,只是那时候是作为主数据库来使用,所以在框架方面会更加复杂,比如使用jpa,如果只是把mongodb作为附数据库使用的话,个人认为通过spring-data-mongodb的mongoTemple来操作数据库即可。 二、spring 整合mongodb 配置文件如下:(用户名 密码缺失) <?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/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www