cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r992258 - in /websites/production/cxf/content: cache/docs.pageCache docs/application-server-specific-configuration-guide.html docs/jaxrs-services-configuration.html docs/springboot.html
Date Thu, 07 Jul 2016 14:47:23 GMT
Author: buildbot
Date: Thu Jul  7 14:47:23 2016
New Revision: 992258

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/application-server-specific-configuration-guide.html
    websites/production/cxf/content/docs/jaxrs-services-configuration.html
    websites/production/cxf/content/docs/springboot.html

Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/cxf/content/docs/application-server-specific-configuration-guide.html
==============================================================================
--- websites/production/cxf/content/docs/application-server-specific-configuration-guide.html
(original)
+++ websites/production/cxf/content/docs/application-server-specific-configuration-guide.html
Thu Jul  7 14:47:23 2016
@@ -118,11 +118,11 @@ Apache CXF -- Application Server Specifi
            <!-- Content -->
            <div class="wiki-content">
 <div id="ConfluenceContent"><p>This document provides app server-specific configuration
information for running Apache CXF.</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1467046024221 {padding: 0px;}
-div.rbtoc1467046024221 ul {list-style: disc;margin-left: 0px;padding-left: 20px;}
-div.rbtoc1467046024221 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1467902807657 {padding: 0px;}
+div.rbtoc1467902807657 ul {list-style: disc;margin-left: 0px;padding-left: 20px;}
+div.rbtoc1467902807657 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1467046024221">
+/*]]>*/</style></p><div class="toc-macro rbtoc1467902807657">
 <ul class="toc-indentation"><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-JBossApplicationServer">JBoss
Application Server</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-SpringBoot">SpringBoot</a></li><li><a
shape="rect" href="#ApplicationServerSpecificConfigurationGuide-WebLogic">WebLogic</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Putjarsinendorsedfolder">Put
jars in endorsed folder</a></li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Packwarinanear,deploytheearwithweblogic-application.xml">Pack
war in an ear, deploy the ear with weblogic-application.xml</a></li></ul>
 </li><li><a shape="rect" href="#ApplicationServerSpecificConfigurationGuide-Websphere">Websphere</a>
@@ -147,7 +147,7 @@ div.rbtoc1467046024221 li {margin-left:
     &lt;/deployment&gt;
 &lt;/jboss-deployment-structure&gt;
 </pre>
-</div></div><p>this approach offers the fastest route to deploying CXF
apps on JBoss AS; the drawback is that no special ws integration with JBoss AS internals is
available</p></li></ul><ul><li>rely on JBossWS integration and
the Apache CXF libraries included in the application server (<a shape="rect" class="external-link"
href="https://docs.jboss.org/author/display/AS71/Webservices+reference+guide" rel="nofollow">documentation</a>):
this implies removing any Apache CXF libs from the ws deployment as well as any other dependencies
which is already included in JBoss AS (including any Java EE API jar); if included, the optional
web.xml descriptor is to be rewritten according to JBossWS convention (see <a shape="rect"
class="external-link" href="https://docs.jboss.org/author/display/AS71/JAX-WS+User+Guide"
rel="nofollow">documentation</a>); the Spring support is optional in JBoss AS and
Spring based endpoint declaration is not the default/preferred configuration approach for
ws endpoin
 ts, hence users willing to declare endpoints using Spring needs to create a org.springframework.spring
module and put their endpoint declarations in a jbossws-cxf.xml descriptor; if the user application
makes use of any lib besides tha JavaEE api, proper module <a shape="rect" class="external-link"
href="https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7" rel="nofollow">dependencies</a>
are to be declared either using the jboss-deployment-structure.xml descriptor or the archive
MANIFEST.MF (few directions on ws modules available <a shape="rect" class="external-link"
href="https://docs.jboss.org/author/display/AS71/JBoss+Modules+and+WS+applications" rel="nofollow">here</a>)</li></ul><p>The
second approach allows leveraging the full JavaEE 6 stack (including e.g. JSR-109) as well
as specific ws integration with JBoss AS internals.</p><h2 id="ApplicationServerSpecificConfigurationGuide-SpringBoot">SpringBoot</h2><p>Please
see CXF <a shape="rect" href="springboot.html">Spri
 ngBoot</a> documenation.</p><p>JAX-WS: see&#160;<a shape="rect"
class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jaxws_spring_boot"
rel="nofollow">JAX-WS Spring Boot</a>&#160;demo.</p><p>JAX-RS: &#160;see&#160;<a
shape="rect" class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot"
rel="nofollow">JAX-RS Spring Boot</a>&#160;and&#160;<a shape="rect" class="external-link"
href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot_scan"
rel="nofollow">JAX-RS Spring Boot Scan</a>&#160;demos.</p><h2 id="ApplicationServerSpecificConfigurationGuide-WebLogic">WebLogic</h2><p>There
are two ways to deploy a CXF WAR archive in WebLogic. (<strong>Note: This has been validated
on WebLogic9.2.</strong>)</p><h4 id="ApplicationServerSpecificConfigurationGuide-Putjarsinendorsedfolder">Put
jars in endorsed folder</h4><ul><li>Pu
 t the geronimo-ws-metadata_2.0_spec-1.1.1.jar in the $Weblogic_Home/jdk_../jre/lib/endorsed
folder.</li><li>Deploy the CXF war in weblogic.<br clear="none"> (This way
is not recommended, since it might break the application server itself. The method below is
preferred, as it impacts a single module only.)</li></ul><h4 id="ApplicationServerSpecificConfigurationGuide-Packwarinanear,deploytheearwithweblogic-application.xml">Pack
war in an ear, deploy the ear with weblogic-application.xml</h4><ul><li><p>Create
a standard J2EE application.xml file in the META-INF folder. (Take $CXF_HOME/samples/java_first_spring_support
for example)</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+</div></div><p>this approach offers the fastest route to deploying CXF
apps on JBoss AS; the drawback is that no special ws integration with JBoss AS internals is
available</p></li></ul><ul><li>rely on JBossWS integration and
the Apache CXF libraries included in the application server (<a shape="rect" class="external-link"
href="https://docs.jboss.org/author/display/AS71/Webservices+reference+guide" rel="nofollow">documentation</a>):
this implies removing any Apache CXF libs from the ws deployment as well as any other dependencies
which is already included in JBoss AS (including any Java EE API jar); if included, the optional
web.xml descriptor is to be rewritten according to JBossWS convention (see <a shape="rect"
class="external-link" href="https://docs.jboss.org/author/display/AS71/JAX-WS+User+Guide"
rel="nofollow">documentation</a>); the Spring support is optional in JBoss AS and
Spring based endpoint declaration is not the default/preferred configuration approach for
ws endpoin
 ts, hence users willing to declare endpoints using Spring needs to create a org.springframework.spring
module and put their endpoint declarations in a jbossws-cxf.xml descriptor; if the user application
makes use of any lib besides tha JavaEE api, proper module <a shape="rect" class="external-link"
href="https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7" rel="nofollow">dependencies</a>
are to be declared either using the jboss-deployment-structure.xml descriptor or the archive
MANIFEST.MF (few directions on ws modules available <a shape="rect" class="external-link"
href="https://docs.jboss.org/author/display/AS71/JBoss+Modules+and+WS+applications" rel="nofollow">here</a>)</li></ul><p>The
second approach allows leveraging the full JavaEE 6 stack (including e.g. JSR-109) as well
as specific ws integration with JBoss AS internals.</p><h2 id="ApplicationServerSpecificConfigurationGuide-SpringBoot">SpringBoot</h2><p>Please
see CXF <a shape="rect" href="springboot.html">Spri
 ngBoot</a> documentation.</p><p>JAX-WS: see&#160;<a shape="rect"
class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jaxws_spring_boot"
rel="nofollow">JAX-WS Spring Boot</a>&#160;demo.</p><p>JAX-RS: &#160;see&#160;<a
shape="rect" class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot"
rel="nofollow">JAX-RS Spring Boot</a>&#160;and&#160;<a shape="rect" class="external-link"
href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot_scan"
rel="nofollow">JAX-RS Spring Boot Scan</a>&#160;demos.</p><h2 id="ApplicationServerSpecificConfigurationGuide-WebLogic">WebLogic</h2><p>There
are two ways to deploy a CXF WAR archive in WebLogic. (<strong>Note: This has been validated
on WebLogic9.2.</strong>)</p><h4 id="ApplicationServerSpecificConfigurationGuide-Putjarsinendorsedfolder">Put
jars in endorsed folder</h4><ul><li>P
 ut the geronimo-ws-metadata_2.0_spec-1.1.1.jar in the $Weblogic_Home/jdk_../jre/lib/endorsed
folder.</li><li>Deploy the CXF war in weblogic.<br clear="none"> (This way
is not recommended, since it might break the application server itself. The method below is
preferred, as it impacts a single module only.)</li></ul><h4 id="ApplicationServerSpecificConfigurationGuide-Packwarinanear,deploytheearwithweblogic-application.xml">Pack
war in an ear, deploy the ear with weblogic-application.xml</h4><ul><li><p>Create
a standard J2EE application.xml file in the META-INF folder. (Take $CXF_HOME/samples/java_first_spring_support
for example)</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
 <pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;?xml
version="1.0" encoding="UTF-8"?&gt;
 &lt;!DOCTYPE application PUBLIC
 		"-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"

Modified: websites/production/cxf/content/docs/jaxrs-services-configuration.html
==============================================================================
--- websites/production/cxf/content/docs/jaxrs-services-configuration.html (original)
+++ websites/production/cxf/content/docs/jaxrs-services-configuration.html Thu Jul  7 14:47:23
2016
@@ -118,11 +118,11 @@ Apache CXF -- JAXRS Services Configurati
            <!-- Content -->
            <div class="wiki-content">
 <div id="ConfluenceContent"><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;<span
class="inline-first-p" style="font-size:2em;font-weight:bold">JAX-RS : Services Configuration</span>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p><style
type="text/css">/*<![CDATA[*/
-div.rbtoc1467046025196 {padding: 0px;}
-div.rbtoc1467046025196 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1467046025196 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1467902808726 {padding: 0px;}
+div.rbtoc1467902808726 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1467902808726 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1467046025196">
+/*]]>*/</style></p><div class="toc-macro rbtoc1467902808726">
 <ul class="toc-indentation"><li><a shape="rect" href="#JAXRSServicesConfiguration-ConfiguringJAX-RSservicesprogrammatically">Configuring
JAX-RS services programmatically</a></li><li><a shape="rect" href="#JAXRSServicesConfiguration-OSGI">OSGI</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#JAXRSServicesConfiguration-Blueprint">Blueprint</a></li><li><a
shape="rect" href="#JAXRSServicesConfiguration-Spring">Spring</a></li></ul>
 </li><li><a shape="rect" href="#JAXRSServicesConfiguration-SpringBoot">Spring
Boot</a></li><li><a shape="rect" href="#JAXRSServicesConfiguration-ConfiguringJAX-RSendpointsprogrammaticallywithoutSpring">Configuring
JAX-RS endpoints programmatically without Spring</a></li><li><a shape="rect"
href="#JAXRSServicesConfiguration-BlueprintWeb">Blueprint Web</a>
@@ -203,7 +203,7 @@ sf.create();
 &lt;/beans&gt;
 
 </pre>
-</div></div><h1 id="JAXRSServicesConfiguration-SpringBoot">Spring Boot</h1><p>Please
see CXF&#160;<a shape="rect" href="springboot.html">SpringBoot</a>&#160;documenation.&#160;</p><p>Please
see <a shape="rect" class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot"
rel="nofollow">JAX-RS Spring Boot</a> and <a shape="rect" class="external-link"
href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application"
rel="nofollow">JAX-RS Spring Boot Scan</a> demos.</p><h1 id="JAXRSServicesConfiguration-ConfiguringJAX-RSendpointsprogrammaticallywithoutSpring">Configuring
JAX-RS endpoints programmatically without Spring</h1><p>Note that even though
no Spring is explicitly used in the previous section, it is still used by default to have
various CXF components registered with the bus such as transport factories. If no Spring libraries
are available on the classpath t
 hen please follow the following example :</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div></div><h1 id="JAXRSServicesConfiguration-SpringBoot">Spring Boot</h1><p>Please
see CXF&#160;<a shape="rect" href="http://cxf.apache.org/docs/springboot.html#SpringBoot-SpringBootCXFJAX-RSStarter">SpringBoot</a>&#160;documentation.&#160;</p><p>Please
see <a shape="rect" class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot"
rel="nofollow">JAX-RS Spring Boot</a> and <a shape="rect" class="external-link"
href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application"
rel="nofollow">JAX-RS Spring Boot Scan</a> demos.</p><h1 id="JAXRSServicesConfiguration-ConfiguringJAX-RSendpointsprogrammaticallywithoutSpring">Configuring
JAX-RS endpoints programmatically without Spring</h1><p>Note that even though
no Spring is explicitly used in the previous section, it is still used by default to have
various CXF components registered with the bus such as transport 
 factories. If no Spring libraries are available on the classpath then please follow the following
example :</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">JAXRSServerFactoryBean
sf = new JAXRSServerFactoryBean();
 sf.setResourceClasses(CustomerService.class);
 sf.setResourceProvider(CustomerService.class, new SingletonResourceProvider(new CustomerService()));

Modified: websites/production/cxf/content/docs/springboot.html
==============================================================================
--- websites/production/cxf/content/docs/springboot.html (original)
+++ websites/production/cxf/content/docs/springboot.html Thu Jul  7 14:47:23 2016
@@ -32,7 +32,9 @@
 <link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shThemeCXF.css">
 
 <script src='/resources/highlighter/scripts/shCore.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
 <script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script src='/resources/highlighter/scripts/shBrushPlain.js'></script>
 <script>
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -117,29 +119,107 @@ Apache CXF -- SpringBoot
            <!-- Content -->
            <div class="wiki-content">
 <div id="ConfluenceContent"><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1467715617929 {padding: 0px;}
-div.rbtoc1467715617929 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1467715617929 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1467902809149 {padding: 0px;}
+div.rbtoc1467902809149 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1467902809149 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1467715617929">
+/*]]>*/</style></p><div class="toc-macro rbtoc1467902809149">
 <ul class="toc-indentation"><li><a shape="rect" href="#SpringBoot-SpringBootCXFJAX-WSStarter">Spring
Boot CXF JAX-WS Starter</a>
-<ul class="toc-indentation"><li><a shape="rect" href="#SpringBoot-Features">Features</a></li><li><a
shape="rect" href="#SpringBoot-Setup">Setup</a></li><li><a shape="rect"
href="#SpringBoot-AdditionalConfiguration">Additional Configuration</a></li></ul>
+<ul class="toc-indentation"><li><a shape="rect" href="#SpringBoot-Features">Features</a></li><li><a
shape="rect" href="#SpringBoot-Setup">Setup</a></li><li><a shape="rect"
href="#SpringBoot-Examples">Examples</a></li><li><a shape="rect" href="#SpringBoot-AdditionalConfiguration">Additional
Configuration</a></li></ul>
 </li><li><a shape="rect" href="#SpringBoot-SpringBootCXFJAX-RSStarter">Spring
Boot CXF&#160;JAX-RS Starter</a>
-<ul class="toc-indentation"><li><a shape="rect" href="#SpringBoot-Features.1">Features</a></li><li><a
shape="rect" href="#SpringBoot-Setup.1">Setup</a></li><li><a shape="rect"
href="#SpringBoot-AdditionalConfiguration.1">Additional Configuration</a></li></ul>
+<ul class="toc-indentation"><li><a shape="rect" href="#SpringBoot-Features.1">Features</a></li><li><a
shape="rect" href="#SpringBoot-Setup.1">Setup</a></li><li><a shape="rect"
href="#SpringBoot-AdditionalConfiguration.1">Additional Configuration</a></li><li><a
shape="rect" href="#SpringBoot-Examples.1">Examples</a>
+<ul class="toc-indentation"><li><a shape="rect" href="#SpringBoot-ManualConfiguration">Manual
Configuration</a></li><li><a shape="rect" href="#SpringBoot-AutoConfiguration">Auto
Configuration</a></li></ul>
 </li></ul>
-</div><h1 id="SpringBoot-SpringBootCXFJAX-WSStarter">Spring Boot CXF JAX-WS Starter</h1><h2
id="SpringBoot-Features">Features</h2><p>Registers CXFServlet with a &#160;"/services/*"
URL pattern for serving CXF JAX-WS endpoints.</p><p>Please see <a shape="rect"
class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jaxws_spring_boot"
rel="nofollow">JAX-WS Spring Boot</a> demo.</p><h2 id="SpringBoot-Setup">Setup</h2><div
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader
pdl" style="border-bottom-width: 1px;"><b>JAX-WS Starter</b></div><div
class="codeContent panelContent pdl">
+</li></ul>
+</div><h1 id="SpringBoot-SpringBootCXFJAX-WSStarter">Spring Boot CXF JAX-WS Starter</h1><h2
id="SpringBoot-Features">Features</h2><p>Registers CXFServlet with a &#160;"/services/*"
URL pattern for serving CXF JAX-WS endpoints.</p><h2 id="SpringBoot-Setup">Setup</h2><div
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader
pdl" style="border-bottom-width: 1px;"><b>JAX-WS Starter</b></div><div
class="codeContent panelContent pdl">
 <pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;dependency&gt;
     &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
     &lt;artifactId&gt;cxf-spring-boot-starter-jaxws&lt;/artifactId&gt;
     &lt;version&gt;3.1.7&lt;/version&gt;
 &lt;/dependency&gt;</pre>
-</div></div><p>&#160;</p><h2 id="SpringBoot-AdditionalConfiguration">Additional
Configuration</h2><p>Use "<strong>cxf.path</strong>" property to customize
a CXFServlet URL pattern.</p><h1 id="SpringBoot-SpringBootCXFJAX-RSStarter">Spring
Boot CXF&#160;JAX-RS Starter</h1><h2 id="SpringBoot-Features.1">Features</h2><p>Registers
CXF Servlet with a &#160;"/services/*" URL pattern for serving CXF JAX-RS endpoints.</p><p>Optionally
auto-discovers JAX-RS root resources and providers and creates a JAX-RS endpoint.</p><p>Please
see <a shape="rect" class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot"
rel="nofollow">JAX-RS Spring Boot</a> and <a shape="rect" class="external-link"
href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application"
rel="nofollow">JAX-RS Spring Boot Scan</a> demos.</p><h2 id="SpringBoot-Setup.1">Setup</h2><div
class="code panel pdl" st
 yle="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>JAX-RS Starter</b></div><div class="codeContent panelContent
pdl">
+</div></div><h2 id="SpringBoot-Examples">Examples</h2><p>Consider
the following Configuration instance:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>JAX-WS
Configuration</b></div><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">package
sample.ws;
+
+import javax.xml.ws.Endpoint;
+import org.apache.cxf.Bus;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import sample.ws.service.HelloPortImpl;
+
+
+@Configuration
+public class WebServiceConfig {
+    @Autowired
+    private Bus bus;
+
+    @Bean
+    public Endpoint endpoint() {
+        EndpointImpl endpoint = new EndpointImpl(bus, new HelloPortImpl());
+        endpoint.publish("/Hello");
+        return endpoint;
+    }
+}</pre>
+</div></div><p>&#160;</p><p>Having a CXF JAX-WS starter
alongside this Configuration is sufficient for enabling a CXF JAX-WS endpoint which will respond
to SOAP request URI such as</p><p>"http://localhost:8080/services/Hello".</p><p>Please
also see a <a shape="rect" class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jaxws_spring_boot"
rel="nofollow">JAX-WS Spring Boot</a> demo.</p><h2 id="SpringBoot-AdditionalConfiguration">Additional
Configuration</h2><p>Use "<strong>cxf.path</strong>" property to customize
a CXFServlet URL pattern.</p><h1 id="SpringBoot-SpringBootCXFJAX-RSStarter">Spring
Boot CXF&#160;JAX-RS Starter</h1><h2 id="SpringBoot-Features.1">Features</h2><p>Registers
CXF Servlet with a &#160;"/services/*" URL pattern for serving CXF JAX-RS endpoints.</p><p>Optionally
auto-discovers JAX-RS root resources and providers and creates a JAX-RS endpoint.</p><h2
id="SpringBoot-Setup.1">Setup</h2><div class="code panel pdl" 
 style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>JAX-RS Starter</b></div><div class="codeContent panelContent
pdl">
 <pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;dependency&gt;
     &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
     &lt;artifactId&gt;cxf-spring-boot-starter-jaxrs&lt;/artifactId&gt;
     &lt;version&gt;3.1.7&lt;/version&gt;
 &lt;/dependency&gt;</pre>
-</div></div><h2 id="SpringBoot-AdditionalConfiguration.1">Additional Configuration</h2><p>Use
"<strong>cxf.path</strong>" property to customize a CXFServlet URL pattern.</p><p>Use
"<strong>cxf.jaxrs.component-scan</strong>" property to create a JAX-RS endpoint
from the auto-discovered&#160;JAX-RS root resources and providers which are marked as
Spring Components (annotated with Spring @Component or created and returned from @Bean methods).</p><p>Use
"<strong>cxf.jaxrs.classes-scan</strong>" property to create a JAX-RS endpoint
from the auto-discovered&#160;JAX-RS root resources and provider classes. Such classes
do not have to be annotated with Spring @Component. This property needs to be accompanied
by a "<strong>cxf.jaxrs.classes-scan-packages</strong>" property which sets a
comma-separated list of the packages to scan.</p><p>Note "<strong>cxf.jaxrs.component-scan</strong>"
and "<strong>cxf.jaxrs.classes-scan</strong>" are mutually exclusive.</p><p>&#160;</p></div>
+</div></div><h2 id="SpringBoot-AdditionalConfiguration.1">Additional Configuration</h2><p>Use
"<strong>cxf.path</strong>" property to customize a CXFServlet URL pattern.</p><p>JAX-RS
root resources and providers annotated with JAX-RS @Path and @Provider and native CXF Providers
annotated with CXF <a shape="rect" class="external-link" href="https://github.com/apache/cxf/blob/cxf-3.1.6/core/src/main/java/org/apache/cxf/annotations/Provider.java"
rel="nofollow">@Provider</a> can be auto-discovered.</p><p>Use "<strong>cxf.jaxrs.component-scan</strong>"
property to create a JAX-RS endpoint from the auto-discovered&#160;JAX-RS root resources
and providers which are marked as Spring Components (annotated with Spring @Component or created
and returned from @Bean methods).</p><p>Use "<strong>cxf.jaxrs.classes-scan</strong>"
property to create a JAX-RS endpoint from the auto-discovered&#160;JAX-RS root resources
and provider classes. Such classes do not have to be annotated with Spring @Compo
 nent. This property needs to be accompanied by a "<strong>cxf.jaxrs.classes-scan-packages</strong>"
property which sets a comma-separated list of the packages to scan.</p><p>Note
that while "<strong>cxf.jaxrs.component-scan</strong>" and "<strong>cxf.jaxrs.classes-scan</strong>"
are mutually exclusive, "<strong>cxf.jaxrs.component-scan</strong>" can be used
alongside the "<strong>cxf.jaxrs.classes-scan-packages</strong>" property to enable
the auto-discovery of the JAX-RS resources and providers which may or may not be marked as
Spring Components.</p><h2 id="SpringBoot-Examples.1">Examples</h2><h3
id="SpringBoot-ManualConfiguration">Manual Configuration</h3><p>Consider the
following Configuration instance:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>JAX-RS
Configuration</b></div><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">package
sample.rs.service;
+import java.util.Arrays;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+
+import sample.rs.service.hello1.HelloServiceImpl1;
+import sample.rs.service.hello2.HelloServiceImpl2;
+
+@SpringBootApplication
+public class SampleRestApplication {
+    @Autowired
+    private Bus bus;
+
+    public static void main(String[] args) {
+        SpringApplication.run(SampleRestApplication.class, args);
+    }
+ 
+    @Bean
+    public Server rsServer() {
+        JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
+        endpoint.setBus(bus);
+        endpoint.setAddress("/");
+        // Register 2 JAX-RS root resources supporting "/sayHello/{id}" and "/sayHello2/{id}"
relative paths
+        endpoint.setServiceBeans(Arrays.&lt;Object&gt;asList(new HelloServiceImpl1(),
new HelloServiceImpl2()));
+        endpoint.setFeatures(Arrays.asList(new Swagger2Feature()));
+        return endpoint.create();
+    }
+}</pre>
+</div></div><p>&#160;</p><p>Having a CXF JAX-RS starter
alongside this Configuration is sufficient for enabling a CXF JAX-RS endpoint which will respond
to HTTP request URI such as</p><p>"<a shape="rect" class="external-link" href="http://localhost:8080/services/Hello"
rel="nofollow">http://localhost:8080/services/sayHello/ApacheCxfUser</a>". The above
code also makes Swagger docs available at&#160;"<a shape="rect" class="external-link"
href="http://localhost:8080/services/Hello" rel="nofollow">http://localhost:8080/services/swagger.json</a>".</p><p>Please
also see a <a shape="rect" class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot"
rel="nofollow">JAX-RS Spring Boot</a> demo.</p><p>&#160;</p><h3
id="SpringBoot-AutoConfiguration">Auto Configuration</h3><p>Spring Boot Application
example shown in the Manual Configuration section can be simplified if the auto-discovery
is enabled.</p><p>For example, given the 
 following application.yml properties:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Application
Properties</b></div><div class="codeContent panelContent pdl">
+<pre class="brush: text; gutter: false; theme: Default" style="font-size:12px;">&#160;cxf:
+  jaxrs:
+    component-scan: true
+    classes-scan-packages: org.apache.cxf.jaxrs.swagger</pre>
+</div></div><p>&#160;</p><p>the application becomes simply:</p><p>&#160;</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader
pdl" style="border-bottom-width: 1px;"><b>JAX-RS Auto Configuration</b></div><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">package
sample.rs.service;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class SampleScanRestApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(SampleScanRestApplication.class, args);
+    }
+}</pre>
+</div></div><p>&#160;</p><p>This application will enable
a CXF JAX-RS endpoint which will respond to HTTP request URI such as</p><p>"<a
shape="rect" class="external-link" href="http://localhost:8080/services/Hello" rel="nofollow">http://localhost:8080/services/sayHello/ApacheCxfUser</a>".
The above code also makes Swagger docs available at&#160;"<a shape="rect" class="external-link"
href="http://localhost:8080/services/Hello" rel="nofollow">http://localhost:8080/services/swagger.json</a>".</p><p>Please
also see a <a shape="rect" class="external-link" href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application"
rel="nofollow">JAX-RS Spring Boot Scan</a> demo.</p><p>&#160;</p></div>
            </div>
            <!-- Content -->
          </td>



Mime
View raw message