首先导入包,我用的是gradle构建工具
compile("org.springframework.boot:spring-boot-starter-actuator")
启动的时候会发现启动日志里面有
/actuator路径下暴露两个端点,也就是官方文档中提到的默认的两个观点/health和/info
如果你想暴露更多的端点,可以通过在application.yml文件中增加配置
例如:暴露除了env和beans之外的所有端口。那此时,启动日志应该显示的是暴露了13个端点。
management:
endpoints:
web:
exposure:
include: '*'
exclude: env,beans