我设计了一个带有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