Spring Boot Actuator / health endpoint不显示数据库或文件系统信息 [英] Spring Boot Actuator /health endpoint does not show database or file system information
问题描述
我无法获取要显示在/ health端点上的数据库信息或文件系统信息。我只能得到:
I cannot get database information or filesystem information to show up on the /health endpoint. I only can get:
{
"status": "UP"
}
有关我的设置和配置的详细信息:
- Spring Boot 1.3.3
- 运行WAR在JBoss EAP 6.4上
- Datasource是一个JNDI资源。
- Oracle是数据库
Details about my setup and configuration: - Spring Boot 1.3.3 - Running the WAR on JBoss EAP 6.4 - Datasource is a JNDI resource. - Oracle is the database
spring:
datasource:
# Must match the datasource name in JBoss standalone.xml
jndi-name: java:jboss/beautiful-ds
driver-class-name: oracle.jdbc.driver.OracleDriver
jpa:
properties:
# escapes reserved words used as column names (if any)
globally_quoted_identifiers: true
show-sql: true
hibernate:
naming_strategy: org.hibernate.cfg.EJB3NamingStrategy
server:
servlet-path: /*
management:
health:
diskspace:
enabled: true
db:
enabled: true
endpoints.health.sensitive: false
我在/ configprops上找到的一件事就是这个,我不确定它是否相关:
One thing i found on /configprops is this, which I'm not sure whether it is related:
"spring.datasource.CONFIGURATION_PROPERTIES": {
"prefix": "spring.datasource",
"properties": {
"error": "Cannot serialize 'spring.datasource'"
}
我曾尝试添加driver-class -name:oracle.jdbc.driver.OracleDriver认为它可能需要更多细节,但这并没有改变这种情况。
I had tried adding "driver-class-name: oracle.jdbc.driver.OracleDriver" thinking it maybe needed more details, but that didn't change the situation.
所以是的,是什么给出的?我做了一个vanilla示例项目,至少显示了文件系统的东西,所以不知道为什么要么不想在我的真实应用程序中显示。告诉我你伟大而明智的答案! :)
so yeah, what gives? I made a vanilla example project which at least shows the filesystem stuff out the gate, so not sure why either don't want to show in my "real" app. Tell me your great and wise answers! :)
推荐答案
如果您使用弹簧安全性,则默认情况下会为执行器端点启用安全性,请在yml文件 -
In cases if you are using spring security, then by default security is enabled for actuator endpoints, disable it in your yml file -
management:
security:
enabled: false
这篇关于Spring Boot Actuator / health endpoint不显示数据库或文件系统信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!