All Downloads are FREE. Search and download functionalities are using the official Maven repository.

handlebars.JavaJaxRS.cxf.server.ApplicationContext.xml.mustache Maven / Gradle / Ivy

There is a newer version: 1.0.54
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<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"
       xmlns:jee="http://www.springframework.org/schema/jee"
       xmlns:context="http://www.springframework.org/schema/context"
       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
                           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
                           http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd">

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

    <!-- JAXRS providers -->
    <bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" />
    
{{#useMultipartFeature}}       
    <bean id="multipartProvider" class="org.apache.cxf.jaxrs.provider.MultipartProvider" />
{{/useMultipartFeature}}    
    
    <!-- Controller -->
{{#useSpringAnnotationConfig}}  
    <context:annotation-config/>
    <context:component-scan base-package="{{apiPackage}}.impl" />
{{/useSpringAnnotationConfig}}
{{^useSpringAnnotationConfig}}    
{{#apiInfo}}
{{#apis}}
    <bean id="{{classname}}" class="{{package}}.impl.{{classname}}ServiceImpl" />
{{/apis}}
{{/apiInfo}}
{{/useSpringAnnotationConfig}}

{{#useSwaggerFeature}}
    {{#useOas2}}
    <!-- CXF Swagger2Feature -->
    <bean id="swagger2Feature" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
        <!--property name="basePath" value="/services"/-->
    {{/useOas2}}
    {{^useOas2}}
    <!-- CXF OpenapiFeature -->
    {{! http://cxf.apache.org/docs/openapifeature.html }}  
    <bean id="openApiFeature" class="org.apache.cxf.jaxrs.openapi.OpenApiFeature">
    {{/useOas2}}
{{#useSwaggerUI}}        
        <property name="supportSwaggerUi" value="true" />
{{/useSwaggerUI}}        
        <!--property name="contact" value="${swagger.contact}" />
        <property name="title" value="${swagger.title}" />
        <property name="version" value="${swagger.version}" />
        <property name="description" value="${swagger.description}" />
        <property name="license" value="${swagger.license}" />
        <property name="licenseUrl" value="${swagger.licenseUrl}" /-->
    </bean>       
{{/useSwaggerFeature}}

    <cxf:bus>
        <cxf:inInterceptors>
{{#useGzipFeature}}            
            <ref bean="GZIPInInterceptor"/>
{{/useGzipFeature}}
{{#useBeanValidationFeature}}                
            <!-- BeanValidation 1.1 for CXF -->
            <ref bean="validationInInterceptor" />
{{/useBeanValidationFeature}}            
        </cxf:inInterceptors>
        <cxf:outInterceptors>
{{#useGzipFeature}}            
            <ref bean="GZIPOutInterceptor"/>
{{/useGzipFeature}}            
{{#useBeanValidationFeature}}
            <!-- BeanValidation 1.1 for CXF -->
            <ref bean="validationOutInterceptor" />
{{/useBeanValidationFeature}}            
        </cxf:outInterceptors>
        <cxf:features>
{{#useLoggingFeature}}         
            <cxf:logging />
{{/useLoggingFeature}}  
{{#useGzipFeature}} 
            <ref bean="compressGZIPFeature"/>
{{/useGzipFeature}}      
        </cxf:features>
        <cxf:properties>
            <entry key="{{#jakarta}}jakarta{{/jakarta}}{{^jakarta}}javax{{/jakarta}}.ws.rs.ext.ExceptionMapper" value-ref="exceptionMapper"/>
        </cxf:properties>
    </cxf:bus>
    
{{#useWadlFeature}}     
    <bean id="wadlGenerator"
          class="org.apache.cxf.jaxrs.model.wadl.WadlGenerator">
        <property name="linkJsonToXmlSchema" value="true" />
    </bean>
{{/useWadlFeature}}

{{#useGzipFeature}} 
    <bean id="GZIPInInterceptor" class="org.apache.cxf.transport.common.gzip.GZIPInInterceptor"/>
    <bean id="GZIPOutInterceptor" class="org.apache.cxf.transport.common.gzip.GZIPOutInterceptor" >
        <!--property name="force" value="true" /-->
        <!--property name="threshold" value="0" /-->
    </bean>
    
    <bean id="compressGZIPFeature" class="org.apache.cxf.transport.common.gzip.GZIPFeature"/>
{{/useGzipFeature}}     

{{#useBeanValidationFeature}}
    <bean id="commonValidationFeature" class="org.apache.cxf.validation.BeanValidationFeature"/>
    <bean id="exceptionMapper" class="org.apache.cxf.jaxrs.validation.ValidationExceptionMapper"/>
    <bean id="validationProvider" class="org.apache.cxf.validation.BeanValidationProvider" />

    <bean id="validationInInterceptor" class="org.apache.cxf.jaxrs.validation.JAXRSBeanValidationInInterceptor">
        <property name="provider" ref="validationProvider" />
    </bean>
     
    <bean id="validationOutInterceptor" class="org.apache.cxf.jaxrs.validation.JAXRSBeanValidationOutInterceptor">
        <property name="provider" ref="validationProvider" />
    </bean>   
{{/useBeanValidationFeature}}
{{^useBeanValidationFeature}}
    <bean id="exceptionMapper" class="org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper">
        <property name="addMessageToResponse" value="true" />
    </bean>
{{/useBeanValidationFeature}}
    
    <!-- REST server -->
    <jaxrs:server id="restServer" address="/services">
        <jaxrs:serviceBeans>
{{#apiInfo}}
{{#apis}}
                <ref bean="{{classname}}" />
{{/apis}}
{{/apiInfo}}
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <ref bean="jsonProvider" />
{{#useMultipartFeature}}            
            <ref bean="multipartProvider" />
{{/useMultipartFeature}}            
{{#useWadlFeature}}            
            <ref bean="wadlGenerator" />
{{/useWadlFeature}}            
        </jaxrs:providers>
        <jaxrs:features>
{{#useSwaggerFeature}}
            {{#useOas2}}
            <ref bean="swagger2Feature" />
            {{/useOas2}}
            {{^useOas2}}
            <ref bean="openApiFeature" />
            {{/useOas2}}
{{/useSwaggerFeature}}              
{{#useBeanValidationFeature}}            
            <ref bean="commonValidationFeature" />
{{/useBeanValidationFeature}}                        
        </jaxrs:features>
    </jaxrs:server>
     
</beans>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy