swagger

spring boot 整合swagger2(knife4j)

空扰寡人 提交于 2020-03-16 10:48:49
1、当然是要引入jar包了 https://doc.xiaominfo.com/guide/settings.html 官网链接 <!-- swagger2接口文档配置 这里使用2.5.0版本,这个版本没问题比较稳定,但是knife4j官网引入的版本有报错--> < dependency > < groupId > io.springfox </ groupId > < artifactId > springfox-swagger2 </ artifactId > < version > 2.5.0 </ version > </ dependency > < dependency > < groupId > com.github.xiaoymin </ groupId > < artifactId > swagger-bootstrap-ui </ artifactId > < version > 1.9.6 </ version > </ dependency > 2、 Swagger 配置文件 package com.sun.woofileyong.config; import org.springframework.context.annotation. Bean ; import org.springframework.context.annotation.

Exact purpose of tags in OpenAPI and why are they unique

两盒软妹~` 提交于 2020-03-16 05:38:59
问题 By Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the Operation Object must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. How are these tags used in parsers, can you provide some

Exact purpose of tags in OpenAPI and why are they unique

陌路散爱 提交于 2020-03-16 05:37:50
问题 By Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the Operation Object must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. How are these tags used in parsers, can you provide some

Exact purpose of tags in OpenAPI and why are they unique

笑着哭i 提交于 2020-03-16 05:36:27
问题 By Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the Operation Object must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. How are these tags used in parsers, can you provide some

Amazon API Gateway Importer整合过程小结

徘徊边缘 提交于 2020-03-16 02:21:02
(1)需要将swagger json转换成amazon api gateway 所需要的格式(根据Method Request中 Request Paths URL Query String Parameters HTTP Request Headers ---> Integration Request 中对应的: URL Path Parameters URL Query String Parameters HTTP Headers )并在Integration Request中填写接口的相对应的信息: Integration type HTTP method Endpoint URL Content Handling 相关说明: ams只是遵守了swagger2的规范,并没有完全支持aws api gateway的扩展 aws api gateway 的json数据, You can fully define an API Gateway API in Swagger using the x-amazon-apigateway-auth and x-amazon-apigateway-integration extensions-------------这个说法是错误的。因为Spring fox2.6.1中的@Extension doesn't allow child

SpringBoot实战:SpringBoot之拦截器(Interceptor)

自闭症网瘾萝莉.ら 提交于 2020-03-11 21:34:33
有个Java Web开发经历的人,对拦截器想必都比较了解了,所以拦截器是什么这里就不多说了,下面将演示SpringBoot如何实现拦截器。 import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * @author wusy * Company: xxxxxx科技有限公司 * Createtime : 2020/3/11 11:28 * Description : 自定义拦截器 */ public class CustomHandlerInterceptor implements HandlerInterceptor { private Logger logger = LoggerFactory

Springboot整合Swagger2

不打扰是莪最后的温柔 提交于 2020-03-10 15:53:35
1、注解 2、 依赖 3、 配置类 4、 实体类 5、 控制层 6、 展示效果 1、注解 @Api:修饰整个类,描述Controller的作用 @ApiOperation:描述一个类的一个方法,或者说一个接口 @ApiParam:单个参数描述 @ApiModel:用对象来接收参数 @ApiModelProperty:用对象接收参数时,描述对象的一个字段 @ApiResponse:HTTP响应其中1个描述 @ApiResponses:HTTP响应整体描述 @ApiIgnore:使用该注解忽略这个API @ApiError :发生错误返回的信息 @ApiImplicitParam:一个请求参数 @ApiImplicitParams:多个请求参数 依赖 < dependency & 来源: CSDN 作者: 1096387637 链接: https://blog.csdn.net/csweldn520/article/details/104774420

SpringBoot实战:SpringBoot之过滤器

左心房为你撑大大i 提交于 2020-03-10 12:01:50
首先我们说说什么是过滤器,过滤器是对数据进行过滤,预处理过程,当我们访问网站时,有时候会发布一些敏感信息,发完以后有的会用*替代,还有就是登陆权限控制等,一个资源,没有经过授权,肯定是不能让用户随便访问的,这个时候,也可以用到过滤器。过滤器的功能还有很多,例如实现URL级别的权限控制、压缩响应信息、编码格式等等。过滤器依赖servlet容器。在实现上基于函数回调,可以对几乎所有请求进行过滤。下面简单的说说Spring Boot里面如何增加过滤器。 接下来我们将演示SpringBoot如何集成过滤器的,主要通过两种方式来实现。 方式一:通过@WebFilter注解来实现 import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import javax.servlet.*; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http

.net core 3.1 WebApi项目---Swagger支持二级目录

半世苍凉 提交于 2020-03-08 10:25:53
1、swagger的二级目录问题 .net core 3.1环境下,我们采用的是引入 Swashbuckle.AspNetCore包产生swagger的json文件,以及swagger ui。配置相对简单,估计百度上有很多了,这里也可以参考如下: 这里集成了jwt的授权头设定 。 public void ConfigureServices(IServiceCollection services) { services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", Title = "后台API接口文档", Description = "API", }); //Set the comments path for the swagger json and ui. var basePath = PlatformServices.Default.Application.ApplicationBasePath; var xmlPath = Path.Combine(basePath, "XXX.Apis.xml"); var dtolXmlPath = Path.Combine(basePath, "XXX.Service.xml"); c.IncludeXmlComments(xmlPath

springmvc4集成swagger2

我是研究僧i 提交于 2020-03-08 03:44:50
首先在原有的springmvc工程的pom文件中增加swagger <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.4.0</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.4.0</version> </dependency> 增加swagger的配置类 package com.founder.fwpt.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import springfox.documentation.builders.ApiInfoBuilder; import springfox