<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements. See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership. The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License. You may obtain a copy of the License at
  
  http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied. See the License for the
  specific language governing permissions and limitations
  under the License.
-->
<!-- START SNIPPET: beans -->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://cxf.apache.org/core"
       xmlns:jaxrs="http://cxf.apache.org/jaxrs"
       xsi:schemaLocation="http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
                           http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
                           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <import resource="classpath:META-INF/cxf/cxf.xml" />

    <!-- JAXRS providers -->
    <bean id="jsonProvider" class="tools.jackson.jakarta.rs.json.JacksonJsonProvider" />
    <bean id="multipartProvider" class="org.apache.cxf.jaxrs.provider.MultipartProvider" />
    <bean id="originFilter" class="demo.jaxrs.openapi.server.ApiOriginFilter" />

    <!-- Application resources -->
    <bean id="sampleResource" class="demo.jaxrs.openapi.server.Sample" />
    <bean id="sampleResource2" class="demo.jaxrs.openapi.server.Sample2" />

    <!-- CXF OpenApiFeature -->  
    <bean id="openApiFeature" class="org.apache.cxf.jaxrs.openapi.OpenApiFeature">
        <property name="title" value="Sample REST Application" />
        <property name="useContextBasedConfig" value="true" />
        <property name="scan" value="false" />
        <property name="scannerClass" value="io.swagger.v3.jaxrs2.integration.JaxrsApplicationScanner"/>
    </bean>
    
    <bean id="openApiFeature2" class="org.apache.cxf.jaxrs.openapi.OpenApiFeature">
        <property name="title" value="Sample2 REST Application" />
        <property name="useContextBasedConfig" value="true" />
        <property name="scan" value="false" />
        <property name="scannerClass" value="io.swagger.v3.jaxrs2.integration.JaxrsApplicationScanner"/>
    </bean>

    <cxf:bus>
        <cxf:features>
            <cxf:logging />
        </cxf:features>
    </cxf:bus>

    <jaxrs:server id="sampleServer" address="http://localhost:9000/sample">
        <jaxrs:serviceBeans>
            <ref bean="sampleResource" />
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <ref bean="jsonProvider" />
            <ref bean="multipartProvider" />
            <ref bean="originFilter" />
        </jaxrs:providers>
        <jaxrs:features>
            <ref bean="openApiFeature" />
        </jaxrs:features>
    </jaxrs:server>
    
    <jaxrs:server id="sampleServer2" address="http://localhost:9000/sample2">
        <jaxrs:serviceBeans>
            <ref bean="sampleResource2" />
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <ref bean="jsonProvider" />
            <ref bean="multipartProvider" />
            <ref bean="originFilter" />
        </jaxrs:providers>
        <jaxrs:features>
            <ref bean="openApiFeature2" />
        </jaxrs:features>
    </jaxrs:server>

</beans>
<!-- END SNIPPET: beans -->
