Swagger UI не показывает имя модуля в своем URL и - PullRequest
0 голосов
/ 19 ноября 2018

Я следовал https://dzone.com/articles/spring-boot-restful-api-documentation-with-swagger и разрабатывал Swagger с использованием springfox-swagger-ui и springfox-swagger2 версии 2.9.2.

Я использовал следующие конфигурации, но я хочу, чтобы module-name было распечатано здесь.Также @Api(tags = "User Catalouge", description = "List Of Users"), описание устарело.

@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket productApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.basePackage("guru.springframework.controllers"))
                .paths(regex("/product.*"))
                .build()
                .apiInfo(metaData());
    }
    private ApiInfo metaData() {
        ApiInfo apiInfo = new ApiInfo(
                "Spring Boot REST API",
                "Spring Boot REST API for Online Store",
                "1.0",
                "Terms of service",
                new Contact("John Thompson", "https://springframework.guru/about/", "john@springfrmework.guru"),
               "Apache License Version 2.0",
                "https://www.apache.org/licenses/LICENSE-2.0");
        return apiInfo;
    }
}

enter image description here

1 Ответ

0 голосов
/ 19 ноября 2018

Вам просто нужно установить servlet context path. Spring Boot & Swagger достаточно умен, чтобы распознать URL и взять его в URL.

server.servlet.context-path=/product-details
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...