question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spring Boot Actuator 2.x Mappings

See original GitHub issue

Keeping in mind that Spring Boot 2.x isn’t officially supported yet, the new Endpoint discovery Spring is using for the Actuator is causing the RequestHandlers to produce inaccurate parameter lists. It appears to be not detecting path parameters and also producing an additional optional body parameter (though the UI does not treat it as optional).

Given a few months, will this work differently or is there something I should add to my config to have these discovered properly?

Using Spring Boot 2.0.1 and SpringFox Swagger 2.9.0

    @Bean
    public Docket actuator() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("Spring Boot Actuator")
                .select()
                    .apis(RequestHandlerSelectors.any())
                    .paths(PathSelectors.regex("/actuator.*"))
                .build();
    }
// http://localhost:8095/v2/api-docs?group=Spring%20Boot%20Actuator

{
  ...
  "paths": {
    ...
    "/actuator/env/{toMatch}": {
      "get": {
        "tags": [
          "operation-handler"
        ],
        "summary": "handle",
        "operationId": "handleUsingGET_6",
        "produces": [
          "application/json",
          "application/vnd.spring-boot.actuator.v2+json"
        ],
        "parameters": [
          {
            "in": "body",
            "name": "body",
            "description": "body",
            "required": false,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "object"
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        }
      }
    },
    "/actuator/health": {
      "get": {
        "tags": [
          "operation-handler"
        ],
        "summary": "handle",
        "operationId": "handleUsingGET_8",
        "produces": [
          "application/json",
          "application/vnd.spring-boot.actuator.v2+json"
        ],
        "parameters": [
          {
            "in": "body",
            "name": "body",
            "description": "body",
            "required": false,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "object"
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        }
      }
    },
    ...
  }
}

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
nsriramulucommented, Oct 12, 2018

There is a dirty workaround here. We can use it till either springfox/springboot team fixes it.

3reactions
doanchungtu95commented, May 27, 2020

springboot 2.3 + actuator and swagger 2.9.2 still get this error

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot Actuator Web API Documentation
mappings are described in the following sections. 17.1.2. Dispatcher Servlets Response Structure. When using Spring MVC, the response contains details of any ...
Read more >
Spring Boot Actuator | Baeldung
A quick intro to Spring Boot Actuators - using and extending the existing ones, configuration and rolling your own.
Read more >
Spring Boot 2 health actuator default mapping - Stack Overflow
If you want change /application/health to /health, then you should use endpoints.jmx.domain . Or change path of your application to ROOT. See.
Read more >
Spring Boot Actuator Endpoints - DigitalOcean
Spring Boot Actuator Endpoints lets us monitor and interact with our application. Spring Actuator is a Spring Boot sub-module and provides ...
Read more >
Actuator with Spring Boot 2.x | New features | JavaTechie
This tutorial will guide you what is actuator and its enhancement in spring boot 2. x version also you will learn how to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found