使用Spring Boot 2和MongoTamplete测试与MongoDb的连接

时间:2018-11-13 14:00:20

标签: mongodb spring-boot mongotemplate

我需要定期测试与MongoDB的连接,为此,我想使用MongoTemplate。

我该怎么做?

tks。

1 个答案:

答案 0 :(得分:0)

您可以为此使用Spring Boot Actuator。包括执行器依赖性。在application.properties中包括management.endpoint.health.show-details = ALWAYS。现在您应该能够看到Mongo Connection的状态。