0還有一個問題配置類容易被遺忘貼上配置類的注解?。–onfiguration@EnableSwagger2)?
另一個時404時靜態(tài)資源配置問題:

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:
如圖:

這個問題是因為你系統(tǒng)有安全鑒權導致(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的意外功能。
------------------------------------------------------------------------------------------------------------------------
<dependency>??
<groupId>io.springfox</groupId>??
<artifactId>springfox-swagger2</artifactId>??
<version>2.5.0</version>??
</dependency>??
<dependency>??
<groupId>io.springfox</groupId>??
<artifactId>springfox-swagger-ui</artifactId>??
<version>2.5.0</version>??
</dependency>?
------------------------------------------------------------------------------------------------------------------------
3項目沒有配置項目context-path:
解決給個默認值 "/",或者配好您的context-path: /xxx

@Configuration@EnableSwagger2