我无法在/health端点上显示数据库信息或文件系统信息。我只能获取:
{
"status": "UP"
}
我的设置和配置细节: - Spring Boot 1.3.3 - 在 JBoss EAP 6.4 上运行 WAR 文件 - 数据源是 JNDI 资源。 - Oracle 是数据库
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找到了一件事,但我不确定它是否相关。 "spring.datasource.CONFIGURATION_PROPERTIES": {
"prefix": "spring.datasource",
"properties": {
"error": "Cannot serialize 'spring.datasource'"
}
我曾尝试添加"driver-class-name: oracle.jdbc.driver.OracleDriver",认为可能需要更多详细信息,但这并没有改变情况。
所以,是什么原因呢?我创建了一个基础的示例项目,其中至少展示了文件系统,所以不确定为什么两者都不想在我的“真实”应用程序中显示。请告诉我你伟大而智慧的答案! :)
management.endpointS
开头。但你是对的。该属性的另一个有用值是when-authorized
:https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html#production-ready-health - volkovswhen_authorized
,这也可以正常工作。 - volkovs