我正在开发Spring Boot 2.2. x应用程序。我已按照以下说明将Springfox版本从2.5.x升级到3.0.0:从2.x迁移到3.0.0
Swagger/Springfox配置:
private ApiInfo apiInfo() {
return new ApiInfo(“Api”,”1.0”,swaggerdoc(), new Contact(“Name”,”Url”,”email”),””,””,Collections.emptyList());
}
private String swaggerDoc() {
return “<Html and css as string>”
}
在Springfox 2.5. x生成的SwaggerUI中,我可以看到CSS中的样式标签按预期工作。但是在Springfox 3.0.0中,我可以看到页面没有加载CSS文件,因此将大多数超文本标记语言显示为文本。
有没有想过为什么CSS没有出现在画面中?
看起来最新版本(springfox 3.0.0)中没有包含css和jquery库。我们需要自定义localhost:8080/swagger-ui/的 /index.html调用,以便添加额外的样式并包含jquery。