因为Spring Boot中默认没有提供配置MongoDB连接池的属性,所以需要自己向Spring容器中注入mongoDbFactory
1. 添加依赖
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<relativePath/>
</parent>
<dependencies>
<!-- .. -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId