cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Separating client and server spring boot code in a jaxrs spring boot demo
Date Fri, 08 Jul 2016 11:23:48 GMT
Repository: cxf
Updated Branches:
  refs/heads/master eaf8cd3e0 -> bb5b35d1c


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/bb5b35d1
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/bb5b35d1
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/bb5b35d1

Branch: refs/heads/master
Commit: bb5b35d1c69915db26c2718024bc90733405da53
Parents: eaf8cd3
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Fri Jul 8 12:23:33 2016 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Fri Jul 8 12:23:33 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/bb5b35d1/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/bb5b35d1/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 9eaf71b..811ef91 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/bb5b35d1/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/bb5b35d1/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/bb5b35d1/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/bb5b35d1/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 9e75e85..cf4f057 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>


Mime
View raw message