Spring Data Neo4j禁用健康检查

洼地云 tuoyidashi.png

在使用Neo4j图谱的过程中,当Neo4j数据库没有启动的使用,默认应用程序就不断的进行健康检查,检测数据库是否能够正常连接,当没有启动Neo4j数据库的使用,应用程序就会报错,提示无法进行连接:

Caused by: org.neo4j.driver.v1.exceptions.ServiceUnavailableException: Unable to connect to localhost:7687, ensure the database is running and that there is a working network connection to it.

但是,我们可以通过SpringBoot配置文件application.yml进行配置,停用不断的健康检查,配置如下:

server:
  port: 9012
spring:
  data:
    neo4j:
      uri: bolt://localhost
      username: neo4j
      password: Passw0rd
management:
    neo4j:
      enabled: false

即,将management.health.neo4j.enabled配置为false

Reference

  1. Configuration options
赞(0)
未经允许禁止转载:优米格 » Spring Data Neo4j禁用健康检查

评论 抢沙发

合作&反馈&投稿

商务合作、问题反馈、投稿,欢迎联系

广告合作侵权联系

登录

找回密码

注册