小编Nop*_*phi的帖子

Swagger 2 问题 - Spring Boot

我正在使用教程,一切都工作正常,直到我开始处理 swagger 2 依赖项。\n我现在想知道是否有办法解决这个问题。

\n

Swagger配置:

\n
package com.animes.apirest.config;\n\nimport springfox.documentation.swagger2.annotations.EnableSwagger2;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\n\nimport springfox.documentation.builders.RequestHandlerSelectors;\nimport springfox.documentation.service.ApiInfo;\nimport springfox.documentation.service.Contact;\nimport springfox.documentation.service.VendorExtension;\nimport springfox.documentation.spi.DocumentationType;\nimport springfox.documentation.spring.web.plugins.Docket;\n\n\nimport static springfox.documentation.builders.PathSelectors.regex;\n\nimport java.util.ArrayList;\n\n@Configuration\n@EnableSwagger2\npublic class SwaggerConfig {\n    \n    @Bean\n    public Docket atividadeApi() {\n        return new Docket(DocumentationType.SWAGGER_2)\n                .select()\n                .apis(RequestHandlerSelectors.basePackage("com.atividades.apirest"))\n                .paths(regex("/api.*"))\n                .build()\n                .apiInfo(metaInfo());\n    }\n\n    private ApiInfo metaInfo() {\n\n        ApiInfo apiInfo = new ApiInfo(\n                "Atividades API REST",\n                "API REST de cadastro de atividades.",\n                "1.0",\n                "Terms of Service",\n                new Contact("Jo\xc3\xa3o VR", "www.una.br/",\n                        " "),\n                "Apache License Version 2.0",\n                "https://www.apache.org/licesen.html", new ArrayList<VendorExtension>()\n        );\n\n        return apiInfo;\n    }\n}\n\n
Run Code Online (Sandbox Code Playgroud)\n

pom.xml: …

java spring jpa spring-boot

19
推荐指数
4
解决办法
8万
查看次数

标签 统计

java ×1

jpa ×1

spring ×1

spring-boot ×1