Spring boot 2.1.3 remove extra 'details' f

2019-08-31 02:33发布

问题:

I am porting my service from Spring 1.5 to 2.1.3 and I noticed that after making necessary changes my health endpoint which adds some custom data is returning the JSON with an extra 'details' tag. Is there any way to get rid of it?

Spring 2.1.3

{
"status": "UP",
"details": { 
    "diskSpace": {
        "status": "UP",
        "details": {
            "stats": [
                {
                    "status": "UP",
                    "totalSpace": 64412954624
                }
            ]
        }
    }
}

basic health endpoint without my change:

 {
  "status": "UP",
  "details": {
    "application": {
        "status": "UP"
    }
  }
}

Spring 1.5

{
 "status": "UP",
 "diskSpace": {
    "status": "UP",
    "stats": [
          {
             "status": "UP",
             "totalSpace": 64412954624
          }
       ]
   }
}

basic health endpoint:

{
  "status": "UP",
  "application": {
    "status": "UP"
  }
}

There was no 'details' specifically. I tried this and it does not help - Spring Boot remove extra HealthIndicator information

Note: I have also customized my DiskSpaceHealthIndicator.

Any suggestion is greatly appreciated.