当前位置:首页 > 编程笔记 > 正文
已解决

Spring Boot 请求/actuator/beans 无法访问 返回404

来自网友在路上 188888提问 提问时间:2023-11-09 23:46:18阅读次数: 88

最佳答案 问答题库888位专家为你答疑解惑

问题复现

在保证项目加入了spring-boot-starter-actuator依赖,并成功启动后。通过浏览器进行访问,返回如下图结果:
报错图片

问题排查

1. 查看日志

Spring启动日志
从日志中可以看到基于路径’/actuator’下只暴露了一个端点

2. 访问http://localhost:8080/actuator

在这里插入图片描述

  • 确实之开放了health端点

解决方案

  • 打开/actuator的所有端口

下面通过配置来暴露除了/shutdown之外的所有端点,在application.properties中进行如下配置:

management.endpoints.web.exposure.include=*

重启,再次访问/actuator,可以看到除了/shutdown之外的其他所有端点。
在这里插入图片描述
再次访问/actuator/beans正常显示所有的bean

引用:如何启用Spring Boot Actuator的所有Endpoints

查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"Spring Boot 请求/actuator/beans 无法访问 返回404":http://eshow365.cn/6-36636-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!