未加载openapifeature配置

f45qwnt8  于 2021-10-10  发布在  Java
关注(0)|答案(0)|浏览(240)

我正在尝试向部署在tomcat服务器9上的web应用程序添加openapifeature。以下是我的配置:

<bean class="org.apache.cxf.jaxrs.openapi.OpenApiFeature"
        id="openApiFeature">
        <property name="configLocation" value="/openapi-configuration.json" />
    </bean>
    <jaxrs:server address="${jaxrs.server.address}"
        basePackages="${jaxrs.server.basePackages}">
        <jaxrs:features>
            <ref bean="openApiFeature" />
        </jaxrs:features>
    </jaxrs:server>

以下是文件openapi-configuration.json:

{
  "resourcePackages": [
    "com"
  ],
  "prettyPrint": true,
  "cacheTTL": 0,
  "openAPI": {
    "info": {
      "version": "1.0.0",
      "title": "Sample API",
      "description": "A sample API",
      "contact": {
        "email": "cxf-dev@apache.org"
      },
      "license": {
        "name": "Apache 2.0",
        "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
      }
    },
    "servers": [
      {
        "url": "/app",
        "description": "The sample API server"
      }
    ]
  },
  "userDefinedOptions": {
    "support.swagger.ui": true
  }
}

当我在启动时调试应用程序时。我前面提到的配置都没有设置。我使用的是cxf-rt-rs-service-description-openapi-v3-3.3.7。我不知道我的配置出了什么问题。这对我来说适用于swagger2feature和openapifeature,但在旧版本3.2.4中适用。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题