swagger啟動錯誤Unable to infer base url.
一、swagger版本
<!--swagger jar包-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
二、錯誤
資訊
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:
截圖
三、解決辦法
在啟動類上加入@EnableSwagger2
註解
package com.kj;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@EnableSwagger2
public class SwaggerDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SwaggerDemoApplication.class, args);
}
}
其他無關檔案,僅供參考
swagger配置檔案
package com.kj.config;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2 //開啟swagger
public interface SwaggerConfig {
}
看到這是不是發現了華點。
我這個配置類是interface的。
所以把這個interface改為class也可以
相關文章
- mysql 啟動錯誤MySql
- 【錯誤】 Unable to compile class for JSPCompileJS
- Linux錯誤:xhost unable to open displayLinux
- 啟動uwsgi報錯ImportError: No module named, unable to load appImportErrorAPP
- ubuntu 啟動錯誤stdin:is not ttyUbuntu
- Unable to create index.lock File exists錯誤Index
- Unable to locate package錯誤解決辦法Package
- Apache Hive啟動報NoClassDefFoundError錯誤ApacheHiveError
- ORA-7445(ACCESS_VIOLATION)(unable_to_trans_pc)(UNABLE_TO_WRITE)錯誤
- oracle EBS啟動無錯誤,訪問網頁500錯誤Oracle網頁
- 專案整合Swagger遇到的錯誤Swagger
- 【伺服器】關於錯誤:Smarty:unable to write file伺服器
- Eclipse 啟動專案錯誤:class not foundEclipse
- 啟動PHP時提示初始化錯誤PHP
- ubuntu網路卡啟動錯誤解決方法Ubuntu
- vmware server啟動時503錯誤解決Server
- ASM例項啟動報錯:ORA-29701 :unable to connect to Cluster ManagerASM
- yii2 Unable to verify your data submission錯誤解決
- java 讀取excel 檔案 Unable to recognize OLE stream 錯誤JavaExcel
- Mysql啟動錯誤-server PID file could not be foundMySqlServer
- 記一次Windows下啟動錯誤故障Windows
- ghost win10啟動出現錯誤怎麼解決_ghost win10啟動出現錯誤如何修復Win10
- android錯誤unable to execute dex java heap space解決方案AndroidJava
- Ubuntu 安裝包時提示錯誤E: Unable to locate package mysql-server錯誤 解決辦法UbuntuPackageMySqlServer
- Linux下matlab開啟出現啟動桌面時錯誤LinuxMatlab
- mysql 啟動錯誤(InnoDB: Operating system error number 13 )MySqlError
- mysql服務啟動1053錯誤如何解決MySql
- OUI啟動時的小錯誤PRVF-0002UI
- ASM啟動ORA-27125錯誤診斷ASM
- vm虛擬機器啟動 報511錯誤虛擬機
- 啟動資料庫的其中一個錯誤資料庫
- 解決jpa查詢時,Unable to locate Attribute with the the given name錯誤
- ubuntu安裝軟體出現Unable to locate package錯誤解決UbuntuPackage
- 記一次ORA-27037: unable to obtain file status錯誤AI
- c# Api 錯誤 Unable to resolve service for type while attempting to activate C#APIWhile
- service mysql start出錯,mysql啟動不了,解決mysql: unrecognized service錯誤MySqlZed
- Ubuntu下啟動、停止、重啟MySQL,檢視錯誤日誌命令大全UbuntuMySql
- xcode simulator模擬器啟動報unable to bootXCodeboot