OpenApi与apache camel-cxfrs集成

wwtsj6pe  于 2023-10-18  发布在  Apache
关注(0)|答案(1)|浏览(116)

我想基于我的cxf服务生成openApi文档。我使用了以下资源:https://cxf.apache.org/docs/openapifeature.html当我在不使用camel-cxfrs的情况下启动服务时-一切都正常工作,生成openapi.json并且swagger-ui工作,但是当使用camel-cxfrs - apache时,camel拦截openapi url并尝试处理我有以下蓝图:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
           xmlns:cxf="http://cxf.apache.org/blueprint/core"
           xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
           xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"
           xsi:schemaLocation="
             http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
             http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
              http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
             ">
  <!-- JAXRS providers -->
  <bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" />

  <!-- CXF OpenApiFeature -->
  <bean id="openApiFeature" class="org.apache.cxf.jaxrs.openapi.OpenApiFeature"/>

  <camelcxf:rsServer id="myRsServer" address="/service"
                     serviceClass="foo.MyService">
    <camelcxf:providers>
      <ref component-id="jsonProvider" />
    </camelcxf:providers>
    <camelcxf:features>
      <ref component-id="openApiFeature" />
    </camelcxf:features>
  </camelcxf:rsServer>

  <camelContext xmlns="http://camel.apache.org/schema/blueprint">

    <route>
      <from uri="cxfrs:bean:myRsServer"/>
      ....
    </route>

  </camelContext>
</blueprint>

所用堆栈:

  • 卡拉夫4.2.4
  • apache camel 2.23.2
  • cxf 3.2.7
  • cxf-rs-description-openapi-v3(karaf特性)
  • org.webjars/swagger-ui/3.23.8(bundle)

有没有办法在apache camel中忽略某些url(比如相同的cxf/service/openapi.json)?

相关问题