报错解决 Exception in monitor thread while connecting to server localhost:27017com.mongodb

Springboot默认启用MongoDB,如果没有集成MongoDB在启动项目时会抛出异常:Exception in monitor thread while connecting to server localhost:27017;

只需要在启动类中修改注解:

将注解:

@SpringBootApplication

改为

@SpringBootApplication(exclude = {MongoAutoConfiguration.class, MongoDataAutoConfiguration.class})

即可禁用springboot自带的mongodb配置,项目启动正常。