spring-boot - 在 Spring boot 1.5.2 版本中,Actuator 端点未通过 HTTP 暴露在与应用程序运行相同的端口中
问题描述
我正在使用 springboot 版本 1.5.2.RELEASE 并且我尝试在我的应用程序中实现 spring boot 执行器。我正在端口 8081 中运行我的应用程序。我只想公开两个端点,即健康和信息。当我尝试访问与我的应用程序相同的端口 8081 中的端点时,它没有给出结果并在 Postman 中显示 404 not found 状态。我可以通过http://localhost:8089/admin/info访问端口 8089 中的健康端点。我在端口 8081 中无法实现同样的事情。我已经搜索了答案,但找不到 Spring Boot 版本 1.5.2 的正确答案。我的 application.yml 文件如下所示:
management:
context-path : /admin
endpoints:
web:
exposure:
include: health,info
jmx:
exposure:
exclude: '*'
security:
enabled: true
port: 8081
解决方案
如果您management.port
设置为8089
,那么您将只能在该端口访问管理 API。您将无法在应用程序端口访问它们8081
如果您想访问应用程序端口的管理 API,请不要设置该managment.port
值。它默认使用与应用程序端口相同的端口。
推荐阅读
- command - 基于字符串的命令 ubuntu
- amazon-web-services - 用于读取来自 Elemental 的 CloudWatch 事件的 Lambda 处理程序
- configuration - 高可用性代理配置
- jquery - JQUERY Ajax 调用返回 IIS 10.0 详细错误 - 404.0 - Not Found in ASP.net MVC5 using VS 2017 Community
- linux - 每次通过 ftp 上传新文件时解压同名文件
- django - Apache错误:将python日志写入项目目录外的文件时
- asp.net - 如何使用桌面应用程序更新 Asp.net 的 web.config 文件?
- javascript - 使用 lodash 修剪对象键
- javascript - (节点:1572)UnhandledPromiseRejectionWarning:ValidationError:配置文件验证失败:education.0.fieldsofstudy:需要路径“fieldsofstudy”
- php - Zend 3 - 使用记录器作为服务