官术网_书友最值得收藏!

Enabling or disabling endpoints

By default in Spring Boot, all endpoints are enabled except /shutdown, but you can disable some of them. You can also enable the /shutdown endpoint.

In the application.properties file, it would look like this:

endpoints.shutdown.enabled=true 

In the application.yml file, it would look like this:

endpoints:
   shutdown:
         enabled: true 

Similarly, you can also disable any of the other endpoints as follows:

endpoints._endpoint-id.enabled = false

In the application.yml file, it would look like this:

endpoints:
   _endpoint-id:
         enabled: false 

Let's suppose you want to disable the /health endpoint. Then in the application.properties file, you have to set the following property:

endpoints.health.enabled=true 

In application.yml, it would look like this:

endpoints:
   health:
         enabled: false 

You can also disable all endpoints at once by setting the following property to false in the application.properties file:

endpoints.enabled=false 

In the application.yml file, it would look like this:

endpoints:
   enabled: false 

As you can see, all endpoints will be disabled, so you can enable specific endpoints if you want to enable then by setting endpoints._endpoint-id.enabled = true.

主站蜘蛛池模板: 南投县| 堆龙德庆县| 开平市| 冀州市| 乐平市| 郧西县| 南雄市| 分宜县| 开化县| 上杭县| 拉孜县| 勐海县| 苍梧县| 绩溪县| 潞城市| 白玉县| 拜泉县| 盈江县| 杭锦后旗| 盐亭县| 依安县| 醴陵市| 旬阳县| 峨眉山市| 山丹县| 青海省| 平山县| 临朐县| 驻马店市| 大方县| 桐梓县| 绥宁县| 梅州市| 罗定市| 三穗县| 渝中区| 浪卡子县| 云林县| 光泽县| 周口市| 多伦县|