前言:

  在spring boot的旧版本中,监控端点(如/env)是默认开启的,所以只要项目正常启动,就能通过url获取信息。可是在2.0版本以后,由于安全性考虑,除了/health和/info的端点,默认都是不暴露的。

 

那么,要怎么开启监控点呢?

启动、暴露端点的配置代码如下:(放在application.properties文件中)

#--------------关于actuator暴露端点的配置(version: Spring-Boot-2.0)-----------------
# 说明:
#   1.要通过actuator暴露端点,必须同时是启用(enabled)和暴露(exposed)的
#   2.所有除了/health和/info的端点,默认都是不暴露的
#   3.所有除了/shutdown的端点,默认都是启用的
# PS.生产环境由于安全性的问题,注意不要暴露敏感端点

# 设置暴露所有端点
management.endpoints.web.exposure.include=*

# 设置单个端点(/shutdown)可用
#management.endpoint.shutdown.enabled=true

# 设置暴露所有端点,除了env
#management.endpoints.web.exposure.include=*
#management.endpoints.web.exposure.exclude=env

  

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2021-09-08
  • 2022-12-23
  • 2021-04-19
  • 2021-06-26
  • 2022-12-23
  • 2021-08-30
猜你喜欢
  • 2022-12-23
  • 2021-10-16
  • 2021-12-10
  • 2021-08-14
  • 2021-12-11
  • 2022-01-08
相关资源
相似解决方案