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也可以
相關文章
- 啟動uwsgi報錯ImportError: No module named, unable to load appImportErrorAPP
- 專案整合Swagger遇到的錯誤Swagger
- minikube addons enable ingress 啟動錯誤
- openstack 啟動認證服務錯誤
- Eclipse 啟動專案錯誤:class not foundEclipse
- c# Api 錯誤 Unable to resolve service for type while attempting to activate C#APIWhile
- yii2 Unable to verify your data submission錯誤解決
- 解決jpa查詢時,Unable to locate Attribute with the the given name錯誤
- Ubuntu 安裝包時提示錯誤E: Unable to locate package mysql-server錯誤 解決辦法UbuntuPackageMySqlServer
- 啟動IDEA 報 failed to load jvm dll XXX 錯誤IdeaAIJVM
- mysql服務啟動1053錯誤如何解決MySql
- mysql 啟動錯誤(InnoDB: Operating system error number 13 )MySqlError
- Latex編譯錯誤:Unable to load picture or PDF file 問題解決編譯
- ghost win10啟動出現錯誤怎麼解決_ghost win10啟動出現錯誤如何修復Win10
- xcode simulator模擬器啟動報unable to bootXCodeboot
- SOLIDWORKS啟動時出現指令碼錯誤問題Solid指令碼
- Idea啟動專案報{dataSource-1} closed錯誤Idea
- 安裝ROS出現 Unable to Correct Problems ‘You have Held Broken Packages’ 錯誤ROSPackage
- Ubuntu下啟動、停止、重啟MySQL,檢視錯誤日誌命令大全UbuntuMySql
- ONI無法啟動: Uh oh! Unable to launch Neovim...
- docker image rm發生錯誤 Error response from daemon: conflict: unable to remove repository referenceDockerErrorREM
- Vagrant 啟動 VirtualBox 的問題 ( 誤裝 docker 後報錯 )Docker
- IDEA啟動時報Failed to create JVM錯誤的解決IdeaAIJVM
- 2022IDEA配置啟動lilishop的swagger展示IdeaSwagger
- Springboot整合Swagger2無法正常啟動Spring BootSwagger
- 行動硬碟引數錯誤怎麼解決?行動硬碟開啟出現引數錯誤的修復方法硬碟
- file_get_content s()獲取https出現這個錯誤Unable to find the wrapperHTTPAPP
- 如何處理VirtualBox啟動錯誤訊息:The vboxdrv kernel module is not loaded
- react-native啟動開發常見錯誤(持續更新)React
- 啟動idea時, 碰到"failed to load jvm DLL ..."錯誤 解決方案IdeaAIJVM
- pip install scrapy報錯:error: UnableError
- 關於使用 git 命令列時遇到的錯誤訊息 unable to get local issuer certificateGit命令列
- office安裝錯誤1920提示未能啟動服務解決方法
- 解決android studio 模擬器取法啟動聲音的錯誤Android
- 記一次android app啟動錯誤 Error running :Default Activity not foundAndroidAPPError
- 巧用 TypeScript(五)-- inferTypeScript
- 開啟PHP的錯誤log日誌PHP
- windows10,homestead啟動時,VERR_INTNET_FLT_IF_NOT_FOUND 錯誤解決Windows