spring boot actuator 安全设置 springboot的安全性

[复制链接]
发表于 2026-2-9 23:33:22 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
关于springboot Actuator框架的安全设置方案:
参加security安全验证框架
方案一:
设置信息:
  1. spring:
  2.     security:
  3.         user:
  4.           password: admin
  5.           name: admin
  6. management:
  7.   endpoints:
  8.     web:
  9.       base-path: /monitor
  10.       exposure:
  11.         include: "*"
  12.         # 排除端点
  13.         exclude: shutdown
  14.   server:
  15.     port: 9595
  16.   endpoint:
  17.     health:
  18.       show-details: always
  19.     shutdown:
  20.       enabled: true
复制代码
引入依赖信息
  1. <dependency>
  2.     <groupId>org.springframework.boot</groupId>
  3.     <artifactId>spring-boot-starter-security</artifactId>
  4. </dependency>
复制代码
须要上下战书url对举行处置惩罚;
处置惩罚方法一:只针对端点哀求举行权限校验
  1. @Configuration
  2. @EnableWebSecurity
  3. public class ActuatorSecurityConfig extends WebSecurityConfigurerAdapter {
  4.   @Autowired
  5.   Environment env;
  6.   @Override
  7.   protected void configure(HttpSecurity security) throws Exception {
  8.         String contextPath = env.getProperty("managem
复制代码
回复

使用道具 举报

登录后关闭弹窗

登录参与点评抽奖  加入IT实名职场社区
去登录
快速回复 返回顶部 返回列表