Exception in monitor thread while connecting to server localhost:27017 while accessing MongoDB with Java

I was to add exclusion annotation to my main annotated class,

i.e. instead of

@SpringBootApplication

I should have

@SpringBootApplication
@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})

Try adding

spring.data.mongodb.host=hostIpOnWhichMongoIsRunning
spring.data.mongodb.port=27017

into application.properties.

If Mongo is not running on localhost, this should fix the issue.