【发布时间】:2017-10-01 00:41:59
【问题描述】:
我正在使用 Apache CXF 构建 Spring Boot 应用程序。在尝试添加招摇时,我得到没有在规范中定义的操作!错误,尽管我通过注释 1-2 操作指定。 Swagger 的 CXF 配置部分如下:
factory.setFeatures(Collections.singletonList(createSwaggerFeature()));
public Swagger2Feature createSwaggerFeature() {
Swagger2Feature swagger2Feature = new Swagger2Feature();
swagger2Feature.setPrettyPrint(true);
swagger2Feature.setSupportSwaggerUi(true);
swagger2Feature.setScanAllResources(true);
swagger2Feature.setHost("localhost:8080");
swagger2Feature.setBasePath("/cxf/todo_list");
swagger2Feature.setTitle("TodoList Application");
swagger2Feature.setContact("https://www.github/abondar24");
swagger2Feature.setDescription("Another TodoList application with Spring Boot and Swagger");
swagger2Feature.setVersion("1.0.0");
return swagger2Feature;
}
我认为功能设置不正确。我错过了什么? api-docs 的链接是这样的:http://localhost:8080/cxf/todo_list/api-docs?url=/cxf/todo_list/swagger.json
在 UI 页面的探索字段中:/cxf/todo_list/swagger.json
【问题讨论】:
-
你能在某处提供代码吗?到目前为止,我没有看到任何错误。您还可以将其与工作示例进行比较:github.com/apache/cxf/tree/master/distribution/src/main/release/…