我設計了一個帶有MySQL數據庫的演示程序spring boot應用程序CRUD操作。我的application.properties文件如下。Spring引導執行程序MySQL數據庫健康檢查
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」,我得到{ 「地位」: 「UP」}如響應。我想用彈簧啓動執行器監視我的數據庫(MySQL)。我想看到我的數據庫狀態。
任何人都可以請幫忙嗎?
你需要數據庫的狀態嗎?是否可以請您解釋更多 –
是的,我需要數據庫狀態,而且我並不十分清楚彈簧啓動時我們可以使用彈簧啓動器執行的最大數據庫細節。 – Harshil