jer*_*mon 13 java oracle spring spring-boot spring-boot-actuator
我无法获取数据库信息或文件系统信息以显示在/ health端点上.我只能得到:
{
"status": "UP"
}
Run Code Online (Sandbox Code Playgroud)
有关我的设置和配置的详细信息: - Spring Boot 1.3.3 - 在JBoss EAP 6.4上运行WAR - Datasource是一个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
Run Code Online (Sandbox Code Playgroud)
我在/ configprops上找到的一件事就是这个,我不确定它是否相关:
"spring.datasource.CONFIGURATION_PROPERTIES": {
"prefix": "spring.datasource",
"properties": {
"error": "Cannot serialize 'spring.datasource'"
}
Run Code Online (Sandbox Code Playgroud)
我曾尝试添加"driver-class-name:oracle.jdbc.driver.OracleDriver",认为它可能需要更多细节,但这并没有改变这种情况.
是的,是什么给出的?我做了一个vanilla示例项目,至少显示了文件系统的东西,所以不知道为什么要么不想在我的"真实"应用程序中显示.告诉我你伟大而明智的答案!:)
小智 6
默认情况下,Spring将below属性设置为never
。要查看完整的运行状况详细信息,请在您的中添加以下属性application.properties
。
management.endpoint.health.show-details=always
Run Code Online (Sandbox Code Playgroud)
从spring-boot
文档:
45.6 HealthIndicators 的安全性
HealthIndicators 返回的信息本质上通常有些敏感。例如,您可能不想向全世界发布您的数据库服务器的详细信息。因此,默认情况下,未经身份验证的 HTTP 连接仅公开健康状态。如果您希望始终公开完整的健康信息,您可以将 endpoints.health.sensitive 设置为 false。健康响应也被缓存以防止“拒绝服务”攻击。如果要更改 1000 毫秒的默认缓存周期,请使用 endpoints.health.time-to-live 属性。
确保设置了以下属性。
endpoints.health.sensitive=true # Mark if the endpoint exposes sensitive information.
management.health.db.enabled=true # Enable database health check.
management.health.defaults.enabled=true # Enable default health indicators.
management.health.diskspace.enabled=true # Enable disk space health check.
Run Code Online (Sandbox Code Playgroud)
如果您使用弹簧安全性,则默认情况下为执行器端点启用安全性,在yml文件中禁用它 -
management:
security:
enabled: false
Run Code Online (Sandbox Code Playgroud)
您在配置文件中混合了 YAML 和 Properties 语法。将最后一行替换为以下内容,它应该可以工作:
endpoints:
health:
sensitive: false
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
16682 次 |
最近记录: |