You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2016/07/08 11:26:33 UTC

[1/2] cxf git commit: Separating client and server spring boot code in a jaxrs spring boot demo

Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes a24e05afb -> 35b673cc6


Separating client and server spring boot code in a jaxrs spring boot demo


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4a1ee7cd
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4a1ee7cd
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4a1ee7cd

Branch: refs/heads/3.1.x-fixes
Commit: 4a1ee7cd1175169d448d4bd557e2ae3deff27b4d
Parents: a24e05a
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Fri Jul 8 12:23:33 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Fri Jul 8 12:26:04 2016 +0100

----------------------------------------------------------------------
 .../release/samples/jax_rs/spring_boot/README   | 17 +------
 .../release/samples/jax_rs/spring_boot/pom.xml  | 41 ++++++++--------
 .../rs/client/SampleRestClientApplication.java  | 49 ++++++++++++++------
 .../rs/service/SampleRestApplication.java       | 29 ------------
 .../jax_rs/spring_boot_scan/application/README  | 13 ------
 .../jax_rs/spring_boot_scan/application/pom.xml | 17 -------
 6 files changed, 55 insertions(+), 111 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/4a1ee7cd/distribution/src/main/release/samples/jax_rs/spring_boot/README
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot/README b/distribution/src/main/release/samples/jax_rs/spring_boot/README
index 03373e7..d309ad4 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot/README
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot/README
@@ -6,7 +6,7 @@ with Spring Boot. This demo has two JAX-RS class resources being deployed in a s
 The sample uses Maven. It can be built and run from the command line:
 
 ----
-$ mvn spring-boot:run
+$ mvn -Pserver
 ----
 
 http://localhost:8080/services/helloservice/sayHello/ApacheCxfUser
@@ -23,19 +23,6 @@ description of services.
 To run the client from a command line open a new terminal window and run:
 
 ----
-$ mvn exec:java
+$ mvn -Pclient
 ----
 
-Using Docker:
-If you have Docker running on your machine (and appropriate DOCKER_HOST set), 
-you can run
-
-----
-$ mvn docker:build
-----
-
-to create the Docker image.  Once created, you can start the container via:
-
-----
-docker run -p 8080:8080 -t org.apache.cxf.samples/spring-boot-sample-rs-cxf
-----

http://git-wip-us.apache.org/repos/asf/cxf/blob/4a1ee7cd/distribution/src/main/release/samples/jax_rs/spring_boot/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot/pom.xml b/distribution/src/main/release/samples/jax_rs/spring_boot/pom.xml
index 0901229..870edd1 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot/pom.xml
@@ -27,7 +27,11 @@
             <version>${cxf.version}</version>
         </dependency>
     </dependencies>
+    <profiles>
+        <profile>
+            <id>server</id>
     <build>
+      <defaultGoal>spring-boot:run</defaultGoal>
       <plugins>
         <plugin>
            <groupId>org.springframework.boot</groupId>
@@ -36,30 +40,23 @@
                <mainClass>sample.rs.service.SampleRestApplication</mainClass>
            </configuration>  
         </plugin>
+      </plugins>
+    </build>
+    </profile>
+    <profile>
+            <id>client</id>
+    <build>
+      <defaultGoal>spring-boot:run</defaultGoal>
+      <plugins>
         <plugin>
-            <groupId>org.codehaus.mojo</groupId>
-            <artifactId>exec-maven-plugin</artifactId>
-            <configuration>
-              <mainClass>sample.rs.client.SampleRestClientApplication</mainClass>
-            </configuration>
+           <groupId>org.springframework.boot</groupId>
+           <artifactId>spring-boot-maven-plugin</artifactId>
+           <configuration>
+               <mainClass>sample.rs.client.SampleRestClientApplication</mainClass>
+           </configuration>  
         </plugin>
-        <plugin>
-            <groupId>com.spotify</groupId>
-            <artifactId>docker-maven-plugin</artifactId>
-            <version>0.4.9</version>
-              <configuration>
-                  <imageName>${project.groupId}/${project.artifactId}</imageName>
-                  <baseImage>frolvlad/alpine-oraclejdk8:slim</baseImage>
-                  <entryPoint>java -Djava.security.egd=file:/dev/./urandom -jar ${project.build.finalName}.jar</entryPoint>
-                  <resources>
-                     <resource>
-                         <targetPath>/</targetPath>
-                         <directory>${project.build.directory}</directory>
-                         <include>${project.build.finalName}.jar</include>
-                     </resource>
-                  </resources>
-              </configuration>
-         </plugin>
       </plugins>
     </build>
+    </profile>
+    </profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/4a1ee7cd/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java
index b0ab7f0..0fed450 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java
@@ -18,27 +18,46 @@
  */
 package sample.rs.client;
 
-import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.jaxrs.client.spring.EnableJaxRsProxyClient;
+import org.apache.cxf.jaxrs.client.spring.EnableJaxRsWebClient;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.context.annotation.Bean;
 
 import sample.rs.service.HelloService;
 
-
-public final class SampleRestClientApplication {
-    private HelloService helloService;
-    
+@SpringBootApplication
+@EnableJaxRsWebClient
+@EnableJaxRsProxyClient
+public class SampleRestClientApplication {
     public static void main(String[] args) {
-        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("sample/rs/client/client.xml");
-        SampleRestClientApplication clientApp = ctx.getBean(SampleRestClientApplication.class);
-        System.out.println(clientApp.getHelloService().sayHello("ApacheCxfUser"));
-        ctx.close();
-    }
+        new SpringApplicationBuilder(SampleRestClientApplication.class)
+            .web(false)
+            .run(args);
+    }  
+    @Bean
+    CommandLineRunner initWebClientRunner(final WebClient webClient) {
+      
+      return new CommandLineRunner() {
 
-    public HelloService getHelloService() {
-        return helloService;
+        @Override
+        public void run(String... runArgs) throws Exception {
+            System.out.println(webClient.path("sayHello/ApacheCxfWebClientUser").get(String.class));
+        }
+      };
     }
+    @Bean
+    CommandLineRunner initProxyClientRunner(final HelloService client) {
+      
+      return new CommandLineRunner() {
 
-    public void setHelloService(HelloService helloService) {
-        this.helloService = helloService;
-    }  
+        @Override
+        public void run(String... runArgs) throws Exception {
+            System.out.println(client.sayHello("ApacheCxfProxyUser"));
+        }
+      };
+    }
 }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/4a1ee7cd/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java
index 2bc20df..358ca4a 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java
@@ -22,12 +22,8 @@ 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.client.WebClient;
-import org.apache.cxf.jaxrs.client.spring.EnableJaxRsProxyClient;
-import org.apache.cxf.jaxrs.client.spring.EnableJaxRsWebClient;
 import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.context.annotation.Bean;
@@ -36,8 +32,6 @@ import sample.rs.service.hello1.HelloServiceImpl1;
 import sample.rs.service.hello2.HelloServiceImpl2;
 
 @SpringBootApplication
-@EnableJaxRsWebClient
-@EnableJaxRsProxyClient
 public class SampleRestApplication {
     @Autowired
     private Bus bus;
@@ -55,27 +49,4 @@ public class SampleRestApplication {
         endpoint.setFeatures(Arrays.asList(new Swagger2Feature()));
         return endpoint.create();
     }
- 
-    @Bean
-    CommandLineRunner initWebClientRunner(final WebClient webClient) {
-      
-      return new CommandLineRunner() {
-
-        @Override
-        public void run(String... runArgs) throws Exception {
-            System.out.println(webClient.path("sayHello/ApacheCxfWebClientUser").get(String.class));
-        }
-      };
-    }
-    @Bean
-    CommandLineRunner initProxyClientRunner(final HelloService client) {
-      
-      return new CommandLineRunner() {
-
-        @Override
-        public void run(String... runArgs) throws Exception {
-            System.out.println(client.sayHello("ApacheCxfProxyUser"));
-        }
-      };
-    }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/4a1ee7cd/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
index affe5a7..40dbcf5 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
@@ -30,16 +30,3 @@ To run the client from a command line open a new terminal window and run:
 $ mvn exec:java
 ----
 
-Using Docker:
-If you have Docker running on your machine (and appropriate DOCKER_HOST set), 
-you can run
-
-----
-$ mvn docker:build
-----
-
-to create the Docker image.  Once created, you can start the container via:
-
-----
-docker run -p 8080:8080 -t org.apache.cxf.samples/spring-boot-sample-rs-cxf-scan
-----

http://git-wip-us.apache.org/repos/asf/cxf/blob/4a1ee7cd/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml
index b67e970..3e00ca6 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml
@@ -55,23 +55,6 @@
               <mainClass>sample.rs.client.SampleRestClientApplication</mainClass>
             </configuration>
         </plugin>
-        <plugin>
-            <groupId>com.spotify</groupId>
-            <artifactId>docker-maven-plugin</artifactId>
-            <version>0.4.9</version>
-              <configuration>
-                  <imageName>${project.groupId}/${project.artifactId}</imageName>
-                  <baseImage>frolvlad/alpine-oraclejdk8:slim</baseImage>
-                  <entryPoint>java -Djava.security.egd=file:/dev/./urandom -jar ${project.build.finalName}.jar</entryPoint>
-                  <resources>
-                     <resource>
-                         <targetPath>/</targetPath>
-                         <directory>${project.build.directory}</directory>
-                         <include>${project.build.finalName}.jar</include>
-                     </resource>
-                  </resources>
-              </configuration>
-         </plugin> 
       </plugins>
     </build>
 </project>


[2/2] cxf git commit: Removing redundant spring context

Posted by se...@apache.org.
Removing redundant spring context


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/35b673cc
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/35b673cc
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/35b673cc

Branch: refs/heads/3.1.x-fixes
Commit: 35b673cc6bc3d79098d39b86a00410263fea90e1
Parents: 4a1ee7c
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Fri Jul 8 12:24:47 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Fri Jul 8 12:26:05 2016 +0100

----------------------------------------------------------------------
 .../main/resources/sample/rs/client/client.xml  | 33 --------------------
 1 file changed, 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/35b673cc/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/resources/sample/rs/client/client.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/resources/sample/rs/client/client.xml b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/resources/sample/rs/client/client.xml
deleted file mode 100644
index 7ba6911..0000000
--- a/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/resources/sample/rs/client/client.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans" 
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-       xmlns:jaxrs="http://cxf.apache.org/jaxrs-client"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-                           http://www.springframework.org/schema/beans/spring-beans.xsd
-                           http://cxf.apache.org/jaxrs-client http://cxf.apache.org/schemas/jaxrs-client.xsd">
-    <jaxrs:client id="helloServiceClient" 
-        address="http://localhost:8080/services/helloservice/" 
-        serviceClass="sample.rs.service.HelloService"/>
-        
-    <bean class="sample.rs.client.SampleRestClientApplication">
-        <property name="helloService" ref="helloServiceClient"/>
-    </bean>
-</beans>