java - Swagger UI 和 CXF 规范中没有定义操作

标签 java spring cxf swagger

我正在使用 Apache CXF 构建 Spring Boot 应用程序。在尝试添加 Swagger 时,我得到规范中没有定义的操作!错误,尽管我通过注释指定了 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

最佳答案

我已经解决了这个问题。我忘记将 @Path 注释添加到我的 REST 服务中。完成后,我就 Swagger 开始工作了。我唯一不明白的是 - 如何摆脱默认标签

关于java - Swagger UI 和 CXF 规范中没有定义操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46508257/

相关文章:

java - 在使用 JPA 在 Spring 中保持多对一关系的同时,它添加了额外的不必要的父实体

java.lang.NoClassDefFoundError : org/springframework/orm/hibernate3/support/HibernateDaoSupport 错误

java - 在使用执行器服务创建的线程中使用声明性事务

java - 当从 javascript 客户端调用 api 时,在 java api 中使用二维数组

ssl - 如何在 JBoss Fuse 6.3 的多个端口上配置 HTTPS

java - Google map 信息窗口是否可以与标记重叠

java - 基于预定义整数在 for 循环数组中跳过 0

spring - Apache CXF 噩梦

java - 应用程序已停止,请登录

java - 从 Java 调用 Frege 与参数数量不匹配