Skip to content

Add Support of Actuator endpoints using webflux #713

@ivangfr

Description

@ivangfr

Hi! I am using Spring Boot version 2.3.0.RELEASE and springdoc-openapi-webflux-ui version 1.4.0.

I've spent some time investigating it and I based on this (springdoc/springdoc-openapi-demos@aa6bcf1). I did all the normal setup but it's still not showing.

As far as I understood, you need:

  1. Actuator dependency

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    
  2. In your properties, you must actuator enable

    springdoc:
      show-actuator: true
    
  3. Create a GroupedOpenApi to the actuator

    @Bean
    public GroupedOpenApi actuatorApi() {
       return GroupedOpenApi.builder().group("actuator").pathsToMatch("/actuator/**").build();
    }
    

However, I am still having

Screen Shot 2020-06-06 at 19 50 02

Here is my SpringDocOpenApiConfig

package com.mycompany.productapi.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SpringDocOpenApiConfig {

    @Value("${spring.application.name}")
    private String applicationName;

    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .components(new Components())
                .info(new Info().title(applicationName));
    }

    @Bean
    public GroupedOpenApi customApi() {
        return GroupedOpenApi.builder().group("api").pathsToMatch("/api/**").build();
    }

    @Bean
    public GroupedOpenApi actuatorApi() {
        return GroupedOpenApi.builder().group("actuator").pathsToMatch("/actuator/**").build();
    }

}

What is still missing? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions