SpringBoot启动报com.mongodb.MongoSocketOpenException: Exception opening socket
springboot自动配置了支持mongodb。在启动springboot时会自动实例化一个mongo实例,需要禁用自动配置 ,增加@SpringBootApplication(exclude = MongoAutoConfiguration.class)
解决方案亲测有效
对比测试结果:
未添加exclude = MongoAutoConfiguration.class
加入注解后的启动:
web访问: