首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Swagger UI和CXF规范中未定义任何操作

Swagger UI和CXF规范中未定义任何操作
EN

Stack Overflow用户
提问于 2017-10-01 08:42:00
回答 2查看 13.5K关注 0票数 0

我正在用Apache CXF构建Spring Boot应用程序。当尝试添加swagger时,我得到没有在规范中定义的操作!错误,尽管我通过注释1-2操作指定。Swagger的CXF配置部分如下:

代码语言:javascript
运行
复制
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;
    }

我相信功能没有设置,correctly.What我错过了吗?api-docs的链接如下:http://localhost:8080/cxf/todo_list/api-docs?url=/cxf/todo_list/swagger.json

在UI页面的explore字段中: /cxf/todo_list/swagger.json

EN

回答 2

Stack Overflow用户

发布于 2017-10-05 22:03:21

我已经解决了这个问题。我忘了把@Path注解放到我的REST服务中。在我这么做之后,swagger开始工作了。我唯一不明白的是--如何摆脱默认标签

票数 3
EN

Stack Overflow用户

发布于 2021-08-11 16:46:40

我也有同样的问题,我通过修改控制器模块来修复它

在这里,我从@Controller =>更改为@RestController,并且它起作用了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46508257

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档