springfox

SpringBoot使用Swagger2构建API文档

前提是你 提交于 2019-12-03 15:09:46
第一步:在pom.xml中加入Swagger2依赖 <dependency>   <groupId>io.springfox</groupId>   <artifactId>springfox-swagger2</artifactId>   <version>2.7.0</version> </dependency> <dependency>   <groupId>io.springfox</groupId>   <artifactId>springfox-swagger-ui</artifactId>   <version>2.7.0</version> </dependency> 第二步:创建Swagger2配置类 package com.offcn.springbootdemo.config; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import

swagger2文档使用

时光怂恿深爱的人放手 提交于 2019-12-03 15:00:50
①、导入依赖 <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.2.2</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.2.2</version> </dependency> ②、创建 swagger2 配置类 @Configuration // 声明配置类 @EnableSwagger2 // 开启在线文档 public class SwaggerConfig { //1 声明 api 文档的属性 构建器 public ApiInfo apiInfo(){ return new ApiInfoBuilder().title("swagger2 文档生成测试 ").description(" 测试使用 ") .termsOfServiceUrl("http://ujiuye.com/").contact("java0708") .version("1.0").build(); } //2 配置核心配置信息 public Docket

SpringFox not finding jax-rs endpoints

﹥>﹥吖頭↗ 提交于 2019-12-03 14:50:21
After solving Using Springfox to document jax-rs services in a Spring app , I now find that SpringFox's JSON reply doesn't show any APIs: { "swagger": "2.0", "info": { "description": "Some description", "version": "1.0", "title": "My awesome API", "contact": { "name": "my-email@domain.org" }, "license": {} }, "host": "localhost:9090", "basePath": "/myapp" } Here's springfox-servlet.xml: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org

swagger2 官网配置

[亡魂溺海] 提交于 2019-12-03 13:06:39
<dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.7.0</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.7.0</version> </dependency> ———————————————— 版权声明:本文为CSDN博主「爪哇岛上抓娃娃」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/weixin_37509652/article/details/80094370 来源: https://www.cnblogs.com/lijun6/p/11796215.html

Documenting Spring's login/logout API in Swagger

邮差的信 提交于 2019-12-03 11:58:04
问题 I am developing demo REST service using Spring Boot where user has to login in order to to perform certain subset of operations. After adding Swagger UI (using springfox library) with that simple configuration: @Bean public Docket docApi() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(any()) .paths(PathSelectors.ant("/api/**")) .build() .pathMapping("/") .apiInfo(apiInfo()) .directModelSubstitute(LocalDate.class, String.class) .useDefaultResponseMessages(true)

【Maven】常用依赖

随声附和 提交于 2019-12-03 06:43:31
目录 swagger swagger <!--swagger2--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>${swagger.version}</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>${swagger.version}</version> </dependency> <!--mysql--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.45</version> <scope>runtime</scope> </dependency> 来源: https://www.cnblogs.com/junzifeng/p/11781101.html

Documenting Spring's login/logout API in Swagger

倾然丶 夕夏残阳落幕 提交于 2019-12-03 02:13:30
I am developing demo REST service using Spring Boot where user has to login in order to to perform certain subset of operations. After adding Swagger UI (using springfox library) with that simple configuration: @Bean public Docket docApi() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(any()) .paths(PathSelectors.ant("/api/**")) .build() .pathMapping("/") .apiInfo(apiInfo()) .directModelSubstitute(LocalDate.class, String.class) .useDefaultResponseMessages(true) .enableUrlTemplating(true); } I end up with all apis with all operations listed on Swagger UI page. Unfortunately I

springfox(swagger2) does not work with GsonHttpMessageConverterConfig

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: What I am trying to build is a spring-boot (v1.2.3) application and expose my Rest API with SpringFox(swagger2) v2.0.0 my Swagger Spring config @EnableSwagger2 @Configuration public class SwaggerConfig { @Bean public Docket myApi() { return new Docket(DocumentationType.SWAGGER_2) .genericModelSubstitutes(DeferredResult.class) .useDefaultResponseMessages(false) .forCodeGeneration(false) .pathMapping("/my-prj"); } } I need to use gson to convert my pojo's to json, and I do it this way: @Configuration public class GsonHttpMessageConverterConfig

Springfox swagger - no api-docs with spring boot jersey and gradle

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a spring boot application with jersey and gradle, and I am trying to automatically generate the API documentation using springfox. I have followed the steps here: http://springfox.github.io/springfox/docs/current/ Here is what I did: build.gradle: dependencies { ......... //Swagger compile "io.springfox:springfox-swagger2:2.4.0" compile "io.springfox:springfox-bean-validators:2.4.0" compile 'io.springfox:springfox-swagger-ui:2.4.0' } Spring boot Application: @SpringBootApplication @EnableSwagger2 public class

配置maven阿里云仓库,不用去改maven的setting

匿名 (未验证) 提交于 2019-12-03 00:39:02
配置maven阿里云仓库开始,不用去改maven的setting 如下配置: < project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > < modelVersion > 4.0.0 </ modelVersion > < groupId > com.battcn </ groupId > < parent > < groupId > org.springframework.boot </ groupId > < artifactId > spring-boot-starter-parent </ artifactId > < version > 1.5.4.RELEASE </ version > </ parent > < artifactId > battcn-starter-swagger </ artifactId > < name > battcn-starter-swagger </ name > < url