解决swagger2集成问题,404,1弹窗问题,2启动项目报错,3启动后频繁打印错误日志 /null/swagger-ui.html,

0还有一个问题配置类容易被遗忘贴上配置类的注解!(Configuration@EnableSwagger2) 

另一个时404时静态资源配置问题:



404需要复写MVC映射

1权限控制过程中被拦截了

Unable to infer base url. This is common when using dynamic servlet registration or when the API is behind an API Gateway. The base url is the root of where all the swagger resources are served. For e.g. if the api is available at http://example.org/api/v2/api-docs then the base url is http://example.org/api/. Please enter the location manually:

如图:


这个问题是因为你系统有安全鉴权导致(Shiro /Security)

解决方案:

1.放开对该页面的鉴权



2版本与springBoot(Spring 不兼容造成的)

解决方法:

So you're better off using 2.5.0 in both versions as it has a lot of issues fixed compared!

原文:https://stackoverflow.com/questions/38744115/no-mapping-found-for-swagger-resources-configuration-ui

Different versioning of springfox-swagger2 and springfox-swagger-ui has been an issue. In some cases, like former of 2.5.0 and latter of 2.6.1 version, the integration works fine. But, if former is of 2.6.1 and latter is of 2.4.0, then the ui becomes incompatible. Hence, I suggest if both the dependencies are taken of same version by practice, then unexpected functioning of swagger can be reduced.

中文:springfox-swagger2和springfox-swagger-ui的不同版本一直是个问题。 在某些情况下,如2.5.0之前的版本和2.6.1版本的后者,集成工作正常。 但是,如果前者是2.6.1而后者是2.4.0,则ui变得不相容。 因此,我建议如果两个依赖关系都是通过实践采用相同的版本,那么可以减少swagger的意外功能。

------------------------------------------------------------------------------------------------------------------------

  

io.springfox  

springfox-swagger2  

2.5.0  

  

  

io.springfox  

springfox-swagger-ui  

2.5.0  

 

------------------------------------------------------------------------------------------------------------------------

3项目没有配置项目context-path:

解决给个默认值 "/",或者配好您的context-path: /xxx


servr.context-path


@Configuration@EnableSwagger2

你可能感兴趣的:(解决swagger2集成问题,404,1弹窗问题,2启动项目报错,3启动后频繁打印错误日志 /null/swagger-ui.html,)