【发布时间】:2018-11-13 14:00:20
【问题描述】:
我需要定期测试我与 MongoDB 的连接,为此我想使用 MongoTemplate。
我该怎么做?
tks.
【问题讨论】:
-
不要... Spring Boot 已经为此进行了健康检查,为什么不简单地使用它(只需在您的项目中包含 Sprign Boot Actuator 并自动获取它)。
标签: mongodb spring-boot mongotemplate
我需要定期测试我与 MongoDB 的连接,为此我想使用 MongoTemplate。
我该怎么做?
tks.
【问题讨论】:
标签: mongodb spring-boot mongotemplate
您可以为此使用 Spring Boot Actuator。包括执行器依赖项。在 application.properties 中包括 management.endpoint.health.show-details=ALWAYS。现在您应该可以看到 Mongo Connection 的状态了。
【讨论】: