springfox

How to configure oAuth2 with password flow with Swagger ui in spring boot rest application

微笑、不失礼 提交于 2019-12-04 07:44:54
问题 I have spring boot rest api (resources) which uses another spring boot authorisation server, I have added Swagger config to the resource application to get a nice and quick documentation/test platform for the rest API. my Swagger config looks like this: @Configuration @EnableSwagger2 public class SwaggerConfig { @Autowired private TypeResolver typeResolver; @Value("${app.client.id}") private String clientId; @Value("${app.client.secret}") private String clientSecret; @Value("${info.build.name

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

谁说胖子不能爱 提交于 2019-12-04 03:31:45
问题 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

swagger文档使用(springboot项目)

夙愿已清 提交于 2019-12-03 22:54:23
Swagger2 生成 Spring Boot API 文档 POM 文件 代码支持 访问地址 Swagger UI 注解 Swagger 是一个规范和完整的框架,用于生成、描述、调用和可视化 RESTful 风格的 Web 服务。本文主要介绍了在 Spring Boot 添加 Swagger 支持, 生成可自动维护的 API 文档。 POM 文件 首先我们需要修改工程的 POM 文件 , 添加 Swagger 的 JAR 包 springfox-swagger2 swagger-annotations 。 <dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>2.6.1</version></dependency><dependency><groupId>io.swagger</groupId><artifactId>swagger-annotations</artifactId><version>1.5.13</version></dependency> 代码支持 其次我们需要在代码中添加支持,于 Application 同级目录添加 Swagger 配置类. import org.springframework.context

swagger在maven的使用

别来无恙 提交于 2019-12-03 22:21:02
引入pom.xml中 需要在版本中指定版本 然后导入依赖 <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>${springfox.version}</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>${springfox.version}</version> </dependency> 写一个类 package cn.jiedada.crm.web.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc

springboot使用swagger2创建文档

不问归期 提交于 2019-12-03 20:44:46
一、导入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> 二、配置文件config package com.offcn.springrestfuldemo001.config; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox

Springfox Swagger generating requests with port 80 for HTTPS URLS

点点圈 提交于 2019-12-03 17:27:04
I am experiencing an issue using springfox-swagger2 v2.2.0 related to the request padding port 80 for a HTTP URL. Is there anyway to disable the generation of the port or set the port to 443 programmatically based on a Spring Profile? Generated CURL: curl -X GET --header "Accept: application/json" " https://test.com:80/api/users/search " I had the same issue. It is because Swagger uses a class from Spring Framework which is adding the port 80 to the host property in the /v2/api-docs json response (Check Swagger2Controller.class). I had this issue with spring framework version 4.1.4.Release.

swagger2文档的步骤

最后都变了- 提交于 2019-12-03 16:57:47
传统方法   a: 创建web工程   b: 配置springmvc web.xml   c: 编写controller   d :部署tomact springboot   1 创建springboot 工程 必须继承spring-boot-stater-parent   导依赖 <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> 配置文件Config import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox

Cannot send Authorization Bearer Token using Springfox

♀尐吖头ヾ 提交于 2019-12-03 16:14:52
I'm having trouble understanding why "Authorization: Bearer __" is not being sent in my api using Springfox 2.5.0. I have the following configuration: private ApiKey apiKey() { return new ApiKey( "Authorization", // name: My key - Authorization "api_key", // keyname: api_key "header"); } @Bean SecurityConfiguration security() { return new SecurityConfiguration( null, null, null, "Docserver2_fwk", // app name "BEARER", // api key value ApiKeyVehicle.HEADER, "Authorization", ","); } And the curl being sent is: It seems I am unable to send "Authorization: Bearer Token" in springfox (2.5.0), is

SpringBoot使用Swagger2构建API文档

时光毁灭记忆、已成空白 提交于 2019-12-03 15:44:34
一、添加依赖 <!--SpringBoot使用Swagger2构建API文档的依赖--> <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.config; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox

SpringBoot之Swagger2文档生成

China☆狼群 提交于 2019-12-03 15:32:05
SpringBoot之Swagger2文档生成 1、Swagger2 介绍 编写和维护接口文档是每个程序员的职责,前面我们已经写好的接口现在需要提供一份文档,这样才能方便调用者使用。 考虑到编写接口文档是一个非常枯燥的工作,我们采用 Swagger2 这套自动化文档工具来生成文档,它可以轻松的整合到 Spring Boot 中,并与 Spring MVC 程序配合组织出强大 RESTful API 文档。 2、SpringBoot 开启 Swagger2 支持 第一步:在 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.config; import org.springframework