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

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.

主站蜘蛛池模板: 岐山县| 临沂市| 达拉特旗| 恩施市| 遂昌县| 大洼县| 满城县| 石城县| 轮台县| 维西| 财经| 林周县| 黄石市| 托克逊县| 高州市| 隆昌县| 上高县| 建宁县| 大港区| 萨迦县| 青神县| 马关县| 东乡族自治县| 克什克腾旗| 浪卡子县| 蒙自县| 常州市| 河北区| 乌审旗| 建宁县| 旌德县| 郯城县| 漳浦县| 信丰县| 北票市| 昌吉市| 历史| 贡觉县| 定州市| 河北省| 岑溪市|