每次当我询问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();
}
我尝试了在此stackoverflow issue中编写的所有可能的
localhost:60001/
链接。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:
- "*"