问题一
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:
报错原因:没有开启swagger2
使用@EnableSwagger2开启swagger2
问题解决。
问题二
org.springframework.context.ApplicationContextException: Failed to
start bean 'documentationPluginsBootstrapper
这里是因为springboot版本太高的原因
降低后成功,这里使用成功版本如下
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<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>
问题解决!
问题三
Illegal DefaultValue null for parameter type integer
swagger版本导致的问题
解决办法
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.21</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.21</version>
</dependency>
导入以下依赖后成功进入;
并且没有报错,问题解决