Spring boot + Mongodb
mongodb的增删改查 1、pom包配置 pom包里面添加spring-boot-starter-data-mongodb包引用 < dependencies> < dependency> < groupId>org.springframework.boot </ groupId> < artifactId>spring-boot-starter-data-mongodb </ artifactId> </ dependency> </ dependencies> 2、在application.properties中添加配置 spring. data.mongodb.uri=mongodb:// user: pwd@localhost: 27017/test 多个IP集群可以采用以下配置: spring.data.mongodb.uri= mongodb: //user:pwd@ip1:port1,ip2:port2/database 3、创建数据实体 public class UserEntity implements Serializable { private static final long serialVersionUID = - 3258839839160856613L; private Long id; private String userName;