Home > Java > javaTutorial > body text

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

WBOY
Release: 2023-05-13 18:31:06
forward
2040 people have browsed it

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
Copy after login

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
Copy after login

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=*
Copy after login

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
Copy after login

or

management:
 security:
  enabled:true
Copy after login

can be replaced by

management.endpoints.web.exposure.include=
Copy after login

. 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: "*"
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template