我正在使用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
1 回答
我已经解决了这个问题 . 我忘了把@Path注释放到我的REST服务中 . 在我做完之后,swagger开始工作了 . 我唯一不懂的 - 如何摆脱默认标签