Home  >  Article  >  Java  >  How to solve the problem of invalid management.security.enabled=false in SpringBoot2.x

How to solve the problem of invalid management.security.enabled=false in SpringBoot2.x

WBOY
WBOYforward
2023-05-13 18:31:062037browse

management.security.enabled=false is invalid

1. Expose all endpoints through management.security.enabled=false in version 1.5.x

How to solve the problem of invalid management.security.enabled=false in SpringBoot2.x

Specific configuration class:

org.springframework.boot.actuate.autoconfigure.ManagementServerProperties$Security

2. Switch the SpringBoot version to 2.x. Use the search function of the IDE

Find the class ManagementServerProperties and found that the Security internal class has been deleted

3. Go to the official website to view the method of exposing endpoints in 2.0

Method 1:

# 启用端点 env
management.endpoint.env.enabled=true
 
# 暴露端点 env 配置多个,隔开
management.endpoints.web.exposure.include=env

Method 2:

Method 1 The exposure method requires opening the endpoints that need to be exposed one by one. Method 2 directly opens and exposes all endpoints

management.endpoints.web.exposure.include=*

Note that when using Http to access the endpoints, you need to add the default /actuator prefix

management .security.enabled is obsolete

In Spring boot 2.0,

management.security.enabled=true

or

management:
 security:
  enabled:true

can be replaced by

management.endpoints.web.exposure.include=

. Please use * to release all, or Use "," to separate the interface endpoints that need to be opened, such as: env, health.

yaml configuration *Please add """ (quotation marks) as follows

management:
  endpoints:
    web:
      exposure:
        include: "*"

The above is the detailed content of How to solve the problem of invalid management.security.enabled=false in SpringBoot2.x. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete