Swagger2 API文档泛型格式返回数据,生成格式非预期的泛型格式为Of实例Of,以下图api
问题跟踪流程:api-docs接口返回的数据为Of实例Of->Swagger2Controller->Documentation文档结构生成直接从缓存中读取->查找设置缓存位置DocumentationPluginsBootstrapper.start()-> Docket.configure()配置生成格式配置->找到本身的Docket配置有个forCodeGeneration()方法->CodeGenGenericTypeNamingStrategy.OPEN属性设置缓存
查看项目Docket配置app
return new Docket(DocumentationType.SWAGGER_2) .select() //不显示错误接口地址以及监控接口地址 .paths(Predicates.not(PathSelectors.regex("/error.*|/actuator.*"))).build() .groupName("cloud-teacher-api") .apiInfo(apiInfo()) .forCodeGeneration(true);
解决:去除掉forCodeGeneration(true)代码,避免Of出现,结果以下图泛型数据结果为«T»ui