<?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" />

    <cxf:bus>
        <cxf:features>
            <cxf:logging />
        </cxf:features>
    </cxf:bus>
    
    <!-- JAXRS providers -->
    <bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" />
    <bean id="originFilter" class="demo.jaxrs.swagger.server.ApiOriginFilter" />

    <!-- Application resource for the first Endpoint -->
    <bean id="sampleResource" class="demo.jaxrs.swagger.server.Sample" />

    <!-- Swagger2Feature for the first Endpoint -->  
    <bean id="swagger2Feature" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
        <property name="title" value="Sample REST Application"/>
        <property name="usePathBasedConfig" value="true"/>
    </bean>

    <!-- First Endpoint -->
    <jaxrs:server id="sampleServer" address="/swaggerSample">
        <jaxrs:serviceBeans>
            <ref bean="sampleResource" />
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <ref bean="jsonProvider" />
            <ref bean="originFilter" />
        </jaxrs:providers>
        <jaxrs:features>
            <ref bean="swagger2Feature" />
        </jaxrs:features>
    </jaxrs:server>
    
    <!-- Application resource for the second Endpoint -->
    <bean id="sampleResource2" class="demo.jaxrs.swagger.server.Sample2" />

    <!-- Swagger2Feature for the second Endpoint -->  
    <bean id="swagger2Feature2" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
        <property name="title" value="Sample REST Application"/>
        <property name="usePathBasedConfig" value="true"/>
    </bean>

    <!-- First Endpoint -->
    <jaxrs:server id="sampleServer2" address="/swaggerSample2">
        <jaxrs:serviceBeans>
            <ref bean="sampleResource2" />
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <ref bean="jsonProvider" />
            <ref bean="originFilter" />
        </jaxrs:providers>
        <jaxrs:features>
            <ref bean="swagger2Feature2" />
        </jaxrs:features>
    </jaxrs:server>

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