SpringBoot 監控管理模塊actuator沒有權限的問題


SpringBoot 1.5.9 版本加入actuator依賴后,

訪問/beans 等敏感的信息時候報錯,如下

Tue Mar 07 21:18:57 GMT+08:00 2017 
There was an unexpected error (type=Unauthorized, status=401). 
Full authentication is required to access this resource.

肯定是權限問題了。有兩種方式:

  1.關閉權限:application.properties添加配置參數

management.security.enabled=false

2.添加權限(未測試):

<dependency>    
  <groupId>org.springframework.boot</groupId>    
  <artifactId>spring-boot-starter-security</artifactId>
</dependency>

在property中配置權限



ID 描述 敏感(Sensitive)
autoconfig 顯示一個auto-configuration的報告,該報告展示所有auto-configuration候選者及它們被應用或未被應用的原因 true
beans 顯示一個應用中所有Spring Beans的完整列表 true
configprops 顯示一個所有@ConfigurationProperties的整理列表 true
dump 執行一個線程轉儲 true
env 暴露來自Spring ConfigurableEnvironment的屬性 true
health 展示應用的健康信息(當使用一個未認證連接訪問時顯示一個簡單的’status’,使用認證連接訪問則顯示全部信息詳情) false
info 顯示任意的應用信息 false
metrics 展示當前應用的’指標’信息 true
mappings 顯示一個所有@RequestMapping路徑的整理列表 true
shutdown 允許應用以優雅的方式關閉(默認情況下不啟用) true
trace 顯示trace信息(默認為最新的一些HTTP請求) true


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM