报错:
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:
解决方法:
在启动上的@SpringBootApplication()注解中加入scanBasePackages = “com.xxxx”
//排除数据库连接,因为传递依赖,springboot会自动去读取数据库配置
@SpringBootApplication(scanBasePackages = "com.xxxxx")
public class ServiceOssApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceOssApplication.class,args);
}
}
然后报错会变成
org.springframework.context.ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException
解决办法:
在application配置文件中加入
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
完美解决