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

  • Mastering Spring Boot 2.0
  • Dinesh Rajput
  • 177字
  • 2021-06-25 21:29:20

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.

主站蜘蛛池模板: 芦山县| 米泉市| 馆陶县| 乌鲁木齐市| 洛扎县| 体育| 新闻| 喀什市| 勐海县| 镇坪县| 德昌县| 沧源| 腾冲县| 淮滨县| 万载县| 丰城市| 抚顺县| 视频| 黔西县| 高淳县| 永嘉县| 平原县| 宜阳县| 纳雍县| 特克斯县| 开鲁县| 牙克石市| 光泽县| 闵行区| 朝阳县| 那曲县| 益阳市| 静海县| 甘泉县| 临清市| 新宾| 新泰市| 鄂温| 鹤壁市| 榕江县| 灵石县|