每次我在请求 localhost:60001/info
、localhost:60001/actuator
或其他时收到 404 错误。
{"timestamp":1570711643410,"status":404,"error":"Not Found","message":"No message available","path":"/loginfo"}
它仅适用于 localhost:60001/metrics
和 localhost:60001/health
。
在我的 application.yml 文件中,我添加了所有设置以启用所有可能的端点。
management:
server:
port: 60001
security:
enabled: false
endpoint:
beans:
enabled: true
health:
show-details: ALWAYS
endpoints:
sensitive: true
web:
exposure:
include: *
PS:我还被问到,为什么即使我在 application.yml 中写了错误的管理设置,JAR 文件仍然可以成功构建。例如,show-details: SOME_NOT_EXISTING_THING
而不是 show-details: ALWAYS
我还添加了我在 Baeldung tutorial for Spring Boot 2.x Actuator 中看到的 SecurityWebFilterChain
bean
@Bean
public SecurityWebFilterChain securityWebFilterChain(
ServerHttpSecurity http) {
return http.authorizeExchange()
.pathMatchers("/actuator/**").permitAll()
.anyExchange().authenticated()
.and().build();
}
我尝试了所有可能的localhost:60001/
链接,这些链接已经写在stackoverflow issue中.
PS:http://hostname:portnumber/applicationroot/actuator/health
、http://localhost:60001/loginfo
等。但还是不行。
我使用 Spring Boot 2.1.6:RELEASE
最佳答案
无法发表评论
你可以尝试下面的 yml 吗,因为不带双引号的 Star(*) 在我的 IDE 中无效,可能你的问题是相同的
management:
endpoints:
enabled-by-default: true
web:
exposure:
include:
- "*"
关于java - 为什么在我的例子中 Spring Boot Actuator 不显示/info,/actuator 端点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58323415/