【发布时间】:2017-01-30 13:51:58
【问题描述】:
我设计了一个使用 MySQL 数据库的演示 spring boot 应用程序 CRUD 操作。我的 application.properties 文件如下。
spring.boot.admin.url=http://localhost:8081
spring.datasource.url= jdbc:mysql://localhost:3306/springbootdb
spring.datasource.username=root
spring.datasource.password=admin
endpoints.health.sensitive=false
management.health.db.enabled=true
management.health.defaults.enabled=true
management.health.diskspace.enabled=true
spring.jpa.hibernate.ddl-auto=create-drop
弹簧执行器的POM.xml如下。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>1.3.4</version>
</dependency>
当我尝试点击网址“http://localhost:8080/health”时,我收到 {"status":"UP"} 作为响应。我想用弹簧启动执行器监控我的数据库(MySQL)。我想查看我的数据库状态。
有人可以帮忙吗?
【问题讨论】:
-
你需要数据库的状态吗?你能解释一下吗
-
是的,我需要数据库状态,但我不太清楚使用 Spring Boot 执行器可以获取哪些数据库的最大细节,因为我是 Spring Boot 新手。
标签: java mysql spring spring-boot spring-boot-actuator