Har*_*hil 2 java mysql spring spring-boot spring-boot-actuator
我用MySQL数据库设计了一个演示Spring启动应用程序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
Run Code Online (Sandbox Code Playgroud)
弹簧执行器的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>
Run Code Online (Sandbox Code Playgroud)
当我尝试点击网址" http:// localhost:8080/health "时,我收到{"status":"UP"}作为回复.我想用弹簧启动执行器监视我的数据库(MySQL).我想查看我的数据库状态.
有人可以帮忙吗?
小智 5
将此配置添加到您的application.properties文件中
management.endpoint.health.show-details=always
Run Code Online (Sandbox Code Playgroud)