[main] INFO com.course.Application - Started Application in 11.272 seconds (JVM running for 13.498) 2020-01-10 11:27:13.143 [cluster-ClusterId{value='5e17ef0f1961c94ad6c394a2'

 启动springboot程序的时候出现 了这个问题:

2020-01-10 11:27:12.918 [main] INFO com.course.Application - Started Application in 11.272 seconds (JVM running for 13.498)
2020-01-10 11:27:13.143 [cluster-ClusterId{value='5e17ef0f1961c94ad6c394a2', description='null'}-localhost:27017] INFO org.mongodb.driver.cluster - Exception in monitor thread while connecting to server localhost:27017
com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70)
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:128)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64)
at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79)
at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65)
... 3 common frames omitted

 

解决办法

在启动类添加注解排除MongoAutoConfiguration:

@SpringBootApplication(exclude = MongoAutoConfiguration.class)

你可能感兴趣的:([main] INFO com.course.Application - Started Application in 11.272 seconds (JVM running for 13.498) 2020-01-10 11:27:13.143 [cluster-ClusterId{value='5e17ef0f1961c94ad6c394a2')