Repository: cxf Updated Branches: refs/heads/master 583ad0b27 -> 47691ae5c
Adding a eureka service to the jaxrs scan service (can be used by all other boot demos too), updating demo names Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/47691ae5 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/47691ae5 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/47691ae5 Branch: refs/heads/master Commit: 47691ae5c2c6528d95795a51e98e02b54a033c88 Parents: 583ad0b Author: Sergey Beryozkin <[email protected]> Authored: Mon Jun 27 16:51:03 2016 +0100 Committer: Sergey Beryozkin <[email protected]> Committed: Mon Jun 27 16:51:03 2016 +0100 ---------------------------------------------------------------------- .../samples/jax_rs/jaxrs_spring_boot/README | 41 --------- .../samples/jax_rs/jaxrs_spring_boot/pom.xml | 76 ----------------- .../rs/client/SampleRestClientApplication.java | 44 ---------- .../java/sample/rs/service/HelloService.java | 37 -------- .../rs/service/SampleRestApplication.java | 53 ------------ .../rs/service/hello1/HelloServiceImpl1.java | 30 ------- .../rs/service/hello2/HelloServiceImpl2.java | 32 ------- .../src/main/resources/application.properties | 1 - .../main/resources/sample/rs/client/client.xml | 33 -------- .../jax_rs/jaxrs_spring_boot_scan/README | 41 --------- .../jax_rs/jaxrs_spring_boot_scan/pom.xml | 89 -------------------- .../rs/client/SampleRestClientApplication.java | 43 ---------- .../java/sample/rs/service/HelloService.java | 34 -------- .../rs/service/SampleScanRestApplication.java | 67 --------------- .../rs/service/hello1/HelloServiceImpl1.java | 33 -------- .../rs/service/hello2/HelloServiceImpl2.java | 36 -------- .../src/main/resources/application.yml | 21 ----- .../src/main/resources/bootstrap.yml | 3 - .../main/resources/sample/rs/client/client.xml | 33 -------- .../release/samples/jax_rs/spring_boot/README | 41 +++++++++ .../release/samples/jax_rs/spring_boot/pom.xml | 76 +++++++++++++++++ .../rs/client/SampleRestClientApplication.java | 44 ++++++++++ .../java/sample/rs/service/HelloService.java | 37 ++++++++ .../rs/service/SampleRestApplication.java | 53 ++++++++++++ .../rs/service/hello1/HelloServiceImpl1.java | 30 +++++++ .../rs/service/hello2/HelloServiceImpl2.java | 32 +++++++ .../src/main/resources/application.properties | 1 + .../main/resources/sample/rs/client/client.xml | 33 ++++++++ .../jax_rs/spring_boot_scan/application/README | 45 ++++++++++ .../jax_rs/spring_boot_scan/application/pom.xml | 89 ++++++++++++++++++++ .../rs/client/SampleRestClientApplication.java | 43 ++++++++++ .../java/sample/rs/service/HelloService.java | 34 ++++++++ .../rs/service/SampleScanRestApplication.java | 67 +++++++++++++++ .../rs/service/hello1/HelloServiceImpl1.java | 33 ++++++++ .../rs/service/hello2/HelloServiceImpl2.java | 36 ++++++++ .../src/main/resources/application.yml | 21 +++++ .../src/main/resources/bootstrap.yml | 3 + .../main/resources/sample/rs/client/client.xml | 33 ++++++++ .../spring_boot_scan/eureka-registry/pom.xml | 38 +++++++++ .../registry/eureka/RegistryApplication.java | 14 +++ .../src/main/resources/application.yml | 13 +++ 41 files changed, 816 insertions(+), 747 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/README ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/README b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/README deleted file mode 100644 index 5e1fbf1..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/README +++ /dev/null @@ -1,41 +0,0 @@ -== Spring Boot - Samples - CXF Rest Web Services - -This sample project demonstrates how to use http://projects.spring.io/spring-rs-cxf/[CXF Rest Web Services] -with Spring Boot. - -The sample uses Maven. It can be built and run from the command line: - ----- -$ mvn spring-boot:run ----- - -http://localhost:8080/services/helloservice/sayHello/ApacheCxfUser - -will display "Hello ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!" - -http://localhost:8080/services/helloservice/sayHello2/ApacheCxfUser - -will display "Hello2 ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!" - -http://localhost:8080/services/helloservice/swagger.json will return a Swagger JSON -description of services. - -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 ----- http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/pom.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/pom.xml b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/pom.xml deleted file mode 100644 index fa62e68..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-parent</artifactId> - <version>1.3.5.RELEASE</version> - </parent> - <artifactId>spring-boot-sample-rs-cxf</artifactId> - <groupId>org.apache.cxf.samples</groupId> - <version>3.2.0-SNAPSHOT</version> - <name>Spring Boot CXF REST Application</name> - <description>Spring Boot CXF REST Application</description> - - <properties> - <cxf.version>3.2.0-SNAPSHOT</cxf.version> - </properties> - <dependencies> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-rs-service-description</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-jaxrs</artifactId> - <version>1.5.8</version> - <exclusions> - <exclusion> - <groupId>javax.ws.rs</groupId> - <artifactId>jsr311-api</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <configuration> - <mainClass>sample.rs.service.SampleRestApplication</mainClass> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-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> -</project> http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java deleted file mode 100644 index b0ab7f0..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * 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. - */ -package sample.rs.client; - -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import sample.rs.service.HelloService; - - -public final class SampleRestClientApplication { - private HelloService helloService; - - 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(); - } - - public HelloService getHelloService() { - return helloService; - } - - public void setHelloService(HelloService helloService) { - this.helloService = helloService; - } -} - http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/HelloService.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/HelloService.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/HelloService.java deleted file mode 100644 index bd37a96..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/HelloService.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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. - */ -package sample.rs.service; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.springframework.stereotype.Service; - -@Path("/sayHello") -@Service -public interface HelloService { - - @GET - @Path("/{a}") - @Produces(MediaType.TEXT_PLAIN) - String sayHello(@PathParam("a") String a); - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java deleted file mode 100644 index f739e95..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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. - */ -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.setServiceBeans(Arrays.<Object>asList(new HelloServiceImpl1(), new HelloServiceImpl2())); - endpoint.setAddress("/"); - endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); - return endpoint.create(); - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java deleted file mode 100644 index 0e5d9b8..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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. - */ -package sample.rs.service.hello1; -import io.swagger.annotations.Api; -import sample.rs.service.HelloService; - -@Api("/sayHello") -public class HelloServiceImpl1 implements HelloService { - - public String sayHello(String a) { - return "Hello " + a + ", Welcome to CXF RS Spring Boot World!!!"; - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java deleted file mode 100644 index 9b24c29..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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. - */ -package sample.rs.service.hello2; -import javax.ws.rs.Path; - -import io.swagger.annotations.Api; -import sample.rs.service.HelloService; -@Path("/sayHello2") -@Api("/sayHello2") -public class HelloServiceImpl2 implements HelloService { - - public String sayHello(String a) { - return "Hello2 " + a + ", Welcome to CXF RS Spring Boot World!!!"; - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/resources/application.properties ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/resources/application.properties b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/resources/application.properties deleted file mode 100644 index 27c5c26..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -cxf.path=/services/helloservice \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/resources/sample/rs/client/client.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/resources/sample/rs/client/client.xml b/distribution/src/main/release/samples/jax_rs/jaxrs_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/jaxrs_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> http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/README ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/README b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/README deleted file mode 100644 index a61d608..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/README +++ /dev/null @@ -1,41 +0,0 @@ -== Spring Boot - Samples - CXF Rest Web Services - -This sample project demonstrates how to use http://projects.spring.io/spring-rs-cxf/[CXF Rest Web Services] -with Spring Boot. - -The sample uses Maven. It can be built and run from the command line: - ----- -$ mvn spring-boot:run ----- - -http://localhost:8080/services/helloservice/sayHello/ApacheCxfUser - -will display "Hello ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!" - -http://localhost:8080/services/helloservice/sayHello2/ApacheCxfUser - -will display "Hello2 ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!" - -http://localhost:8080/services/helloservice/swagger.json will return a Swagger JSON -description of services. - -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/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/pom.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/pom.xml b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/pom.xml deleted file mode 100644 index cbf835c..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/pom.xml +++ /dev/null @@ -1,89 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-parent</artifactId> - <version>1.3.5.RELEASE</version> - </parent> - <artifactId>spring-boot-sample-rs-cxf-scan</artifactId> - <groupId>org.apache.cxf.samples</groupId> - <version>3.2.0-SNAPSHOT</version> - <name>Spring Boot CXF REST Scan Application</name> - <description>Spring Boot CXF REST Scan Application</description> - - <properties> - <cxf.version>3.2.0-SNAPSHOT</cxf.version> - </properties> - <dependencies> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-rs-service-description</artifactId> - <version>${cxf.version}</version> - </dependency> - <!-- Eureka Service Discovery Client --> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-eureka</artifactId> - <version>1.0.0.RELEASE</version> - </dependency> - <!-- Actuator Endpoints --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-actuator</artifactId> - <version>1.3.5.RELEASE</version> - </dependency> - - <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-jaxrs</artifactId> - <version>1.5.8</version> - <exclusions> - <exclusion> - <groupId>javax.ws.rs</groupId> - <artifactId>jsr311-api</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <configuration> - <mainClass>sample.rs.service.SampleScanRestApplication</mainClass> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-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> -</project> http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/client/SampleRestClientApplication.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/client/SampleRestClientApplication.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/client/SampleRestClientApplication.java deleted file mode 100644 index 183c4a8..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/client/SampleRestClientApplication.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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. - */ -package sample.rs.client; - -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import sample.rs.service.HelloService; - - -public final class SampleRestClientApplication { - private HelloService helloService; - - 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(); - } - - public HelloService getHelloService() { - return helloService; - } - - public void setHelloService(HelloService helloService) { - this.helloService = helloService; - } -} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/HelloService.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/HelloService.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/HelloService.java deleted file mode 100644 index 706b054..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/HelloService.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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. - */ -package sample.rs.service; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -@Path("/sayHello") -public interface HelloService { - - @GET - @Path("/{a}") - @Produces(MediaType.TEXT_PLAIN) - String sayHello(@PathParam("a") String a); - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/SampleScanRestApplication.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/SampleScanRestApplication.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/SampleScanRestApplication.java deleted file mode 100644 index 68db191..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/SampleScanRestApplication.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * 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. - */ -package sample.rs.service; -import org.apache.cxf.jaxrs.swagger.Swagger2Feature; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.actuate.autoconfigure.ExportMetricWriter; -import org.springframework.boot.actuate.metrics.Metric; -import org.springframework.boot.actuate.metrics.writer.Delta; -import org.springframework.boot.actuate.metrics.writer.MetricWriter; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; - -@SpringBootApplication -@EnableEurekaClient -public class SampleScanRestApplication { - public static void main(String[] args) { - SpringApplication.run(SampleScanRestApplication.class, args); - } - - @Bean - public Swagger2Feature swaggerFeature(ApplicationContext context) { - return new Swagger2Feature(); - } - @Bean - @ExportMetricWriter - public MetricWriter metricWriter() { - return new MetricWriter() { - - @Override - public void set(Metric<?> arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void increment(Delta<?> arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void reset(String arg0) { - // TODO Auto-generated method stub - - } - - }; - } -} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java deleted file mode 100644 index 4ebe2bb..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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. - */ -package sample.rs.service.hello1; -import org.springframework.stereotype.Service; - -import io.swagger.annotations.Api; -import sample.rs.service.HelloService; - -@Api("/sayHello") -@Service -public class HelloServiceImpl1 implements HelloService { - - public String sayHello(String a) { - return "Hello " + a + ", Welcome to CXF RS Spring Boot World!!!"; - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java deleted file mode 100644 index 23f8a1d..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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. - */ -package sample.rs.service.hello2; -import javax.ws.rs.Path; - -import org.springframework.stereotype.Service; - -import io.swagger.annotations.Api; -import sample.rs.service.HelloService; - -@Path("/sayHello2") -@Api("/sayHello2") -@Service -public class HelloServiceImpl2 implements HelloService { - - public String sayHello(String a) { - return "Hello2 " + a + ", Welcome to CXF RS Spring Boot World!!!"; - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/application.yml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/application.yml b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/application.yml deleted file mode 100644 index 9781013..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/application.yml +++ /dev/null @@ -1,21 +0,0 @@ -server: - port: ${vcap.application.port:8080} - servlet-path: /system - -cxf: - path: /services/helloservice - jaxrs: - component-scan: true - -eureka: - client: - serviceUrl: - defaultZone: ${vcap.services.eureka-service.credentials.uri:http://127.0.0.1:8761}/eureka/ - instance: - statusPageUrlPath: /system/info - healthCheckUrlPath: /system/health - ---- -spring: - profiles: cloud - http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/bootstrap.yml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/bootstrap.yml b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/bootstrap.yml deleted file mode 100644 index 64c10bc..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,3 +0,0 @@ -spring: - application: - name: jaxrs-hello-world-service http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/sample/rs/client/client.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/sample/rs/client/client.xml b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/resources/sample/rs/client/client.xml deleted file mode 100644 index 7ba6911..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/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> http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/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 new file mode 100644 index 0000000..5e1fbf1 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot/README @@ -0,0 +1,41 @@ +== Spring Boot - Samples - CXF Rest Web Services + +This sample project demonstrates how to use http://projects.spring.io/spring-rs-cxf/[CXF Rest Web Services] +with Spring Boot. + +The sample uses Maven. It can be built and run from the command line: + +---- +$ mvn spring-boot:run +---- + +http://localhost:8080/services/helloservice/sayHello/ApacheCxfUser + +will display "Hello ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!" + +http://localhost:8080/services/helloservice/sayHello2/ApacheCxfUser + +will display "Hello2 ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!" + +http://localhost:8080/services/helloservice/swagger.json will return a Swagger JSON +description of services. + +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 +---- http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/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 new file mode 100644 index 0000000..fa62e68 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot/pom.xml @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>1.3.5.RELEASE</version> + </parent> + <artifactId>spring-boot-sample-rs-cxf</artifactId> + <groupId>org.apache.cxf.samples</groupId> + <version>3.2.0-SNAPSHOT</version> + <name>Spring Boot CXF REST Application</name> + <description>Spring Boot CXF REST Application</description> + + <properties> + <cxf.version>3.2.0-SNAPSHOT</cxf.version> + </properties> + <dependencies> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-service-description</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-jaxrs</artifactId> + <version>1.5.8</version> + <exclusions> + <exclusion> + <groupId>javax.ws.rs</groupId> + <artifactId>jsr311-api</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <mainClass>sample.rs.service.SampleRestApplication</mainClass> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-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> +</project> http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/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 new file mode 100644 index 0000000..b0ab7f0 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/client/SampleRestClientApplication.java @@ -0,0 +1,44 @@ +/** + * 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. + */ +package sample.rs.client; + +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import sample.rs.service.HelloService; + + +public final class SampleRestClientApplication { + private HelloService helloService; + + 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(); + } + + public HelloService getHelloService() { + return helloService; + } + + public void setHelloService(HelloService helloService) { + this.helloService = helloService; + } +} + http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/HelloService.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/HelloService.java b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/HelloService.java new file mode 100644 index 0000000..bd37a96 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/HelloService.java @@ -0,0 +1,37 @@ +/** + * 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. + */ +package sample.rs.service; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.springframework.stereotype.Service; + +@Path("/sayHello") +@Service +public interface HelloService { + + @GET + @Path("/{a}") + @Produces(MediaType.TEXT_PLAIN) + String sayHello(@PathParam("a") String a); + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/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 new file mode 100644 index 0000000..f739e95 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java @@ -0,0 +1,53 @@ +/** + * 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. + */ +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.setServiceBeans(Arrays.<Object>asList(new HelloServiceImpl1(), new HelloServiceImpl2())); + endpoint.setAddress("/"); + endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); + return endpoint.create(); + } + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java new file mode 100644 index 0000000..0e5d9b8 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java @@ -0,0 +1,30 @@ +/** + * 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. + */ +package sample.rs.service.hello1; +import io.swagger.annotations.Api; +import sample.rs.service.HelloService; + +@Api("/sayHello") +public class HelloServiceImpl1 implements HelloService { + + public String sayHello(String a) { + return "Hello " + a + ", Welcome to CXF RS Spring Boot World!!!"; + } + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java new file mode 100644 index 0000000..9b24c29 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java @@ -0,0 +1,32 @@ +/** + * 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. + */ +package sample.rs.service.hello2; +import javax.ws.rs.Path; + +import io.swagger.annotations.Api; +import sample.rs.service.HelloService; +@Path("/sayHello2") +@Api("/sayHello2") +public class HelloServiceImpl2 implements HelloService { + + public String sayHello(String a) { + return "Hello2 " + a + ", Welcome to CXF RS Spring Boot World!!!"; + } + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/resources/application.properties ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/resources/application.properties b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/resources/application.properties new file mode 100644 index 0000000..27c5c26 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/resources/application.properties @@ -0,0 +1 @@ +cxf.path=/services/helloservice \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/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 new file mode 100644 index 0000000..7ba6911 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot/src/main/resources/sample/rs/client/client.xml @@ -0,0 +1,33 @@ +<?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> http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/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 new file mode 100644 index 0000000..affe5a7 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README @@ -0,0 +1,45 @@ +== Spring Boot - Samples - CXF Rest Web Services + +This sample project demonstrates how to use CXF JAX-RS services +with Spring Boot. This demo has two JAX-RS class resources being auto-discovered +and deployed in a single JAX-RS endpoint. + +The application registers itself with Eureka Registry. + + +The sample uses Maven. It can be built and run from the command line: + +---- +$ mvn spring-boot:run +---- + +http://localhost:8080/services/helloservice/sayHello/ApacheCxfUser + +will display "Hello ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!" + +http://localhost:8080/services/helloservice/sayHello2/ApacheCxfUser + +will display "Hello2 ApacheCxfUser, Welcome to CXF RS Spring Boot World!!!" + +http://localhost:8080/services/helloservice/swagger.json will return a Swagger JSON +description of services. + +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/47691ae5/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 new file mode 100644 index 0000000..cbf835c --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>1.3.5.RELEASE</version> + </parent> + <artifactId>spring-boot-sample-rs-cxf-scan</artifactId> + <groupId>org.apache.cxf.samples</groupId> + <version>3.2.0-SNAPSHOT</version> + <name>Spring Boot CXF REST Scan Application</name> + <description>Spring Boot CXF REST Scan Application</description> + + <properties> + <cxf.version>3.2.0-SNAPSHOT</cxf.version> + </properties> + <dependencies> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-service-description</artifactId> + <version>${cxf.version}</version> + </dependency> + <!-- Eureka Service Discovery Client --> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-eureka</artifactId> + <version>1.0.0.RELEASE</version> + </dependency> + <!-- Actuator Endpoints --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-actuator</artifactId> + <version>1.3.5.RELEASE</version> + </dependency> + + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-jaxrs</artifactId> + <version>1.5.8</version> + <exclusions> + <exclusion> + <groupId>javax.ws.rs</groupId> + <artifactId>jsr311-api</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <mainClass>sample.rs.service.SampleScanRestApplication</mainClass> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-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> +</project> http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/client/SampleRestClientApplication.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/client/SampleRestClientApplication.java b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/client/SampleRestClientApplication.java new file mode 100644 index 0000000..183c4a8 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/client/SampleRestClientApplication.java @@ -0,0 +1,43 @@ +/** + * 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. + */ +package sample.rs.client; + +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import sample.rs.service.HelloService; + + +public final class SampleRestClientApplication { + private HelloService helloService; + + 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(); + } + + public HelloService getHelloService() { + return helloService; + } + + public void setHelloService(HelloService helloService) { + this.helloService = helloService; + } +} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/HelloService.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/HelloService.java b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/HelloService.java new file mode 100644 index 0000000..706b054 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/HelloService.java @@ -0,0 +1,34 @@ +/** + * 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. + */ +package sample.rs.service; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Path("/sayHello") +public interface HelloService { + + @GET + @Path("/{a}") + @Produces(MediaType.TEXT_PLAIN) + String sayHello(@PathParam("a") String a); + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/SampleScanRestApplication.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/SampleScanRestApplication.java b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/SampleScanRestApplication.java new file mode 100644 index 0000000..68db191 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/SampleScanRestApplication.java @@ -0,0 +1,67 @@ +/** + * 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. + */ +package sample.rs.service; +import org.apache.cxf.jaxrs.swagger.Swagger2Feature; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.actuate.autoconfigure.ExportMetricWriter; +import org.springframework.boot.actuate.metrics.Metric; +import org.springframework.boot.actuate.metrics.writer.Delta; +import org.springframework.boot.actuate.metrics.writer.MetricWriter; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +@EnableEurekaClient +public class SampleScanRestApplication { + public static void main(String[] args) { + SpringApplication.run(SampleScanRestApplication.class, args); + } + + @Bean + public Swagger2Feature swaggerFeature(ApplicationContext context) { + return new Swagger2Feature(); + } + @Bean + @ExportMetricWriter + public MetricWriter metricWriter() { + return new MetricWriter() { + + @Override + public void set(Metric<?> arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void increment(Delta<?> arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void reset(String arg0) { + // TODO Auto-generated method stub + + } + + }; + } +} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java new file mode 100644 index 0000000..4ebe2bb --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/hello1/HelloServiceImpl1.java @@ -0,0 +1,33 @@ +/** + * 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. + */ +package sample.rs.service.hello1; +import org.springframework.stereotype.Service; + +import io.swagger.annotations.Api; +import sample.rs.service.HelloService; + +@Api("/sayHello") +@Service +public class HelloServiceImpl1 implements HelloService { + + public String sayHello(String a) { + return "Hello " + a + ", Welcome to CXF RS Spring Boot World!!!"; + } + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java new file mode 100644 index 0000000..23f8a1d --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/service/hello2/HelloServiceImpl2.java @@ -0,0 +1,36 @@ +/** + * 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. + */ +package sample.rs.service.hello2; +import javax.ws.rs.Path; + +import org.springframework.stereotype.Service; + +import io.swagger.annotations.Api; +import sample.rs.service.HelloService; + +@Path("/sayHello2") +@Api("/sayHello2") +@Service +public class HelloServiceImpl2 implements HelloService { + + public String sayHello(String a) { + return "Hello2 " + a + ", Welcome to CXF RS Spring Boot World!!!"; + } + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/application.yml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/application.yml b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/application.yml new file mode 100644 index 0000000..9781013 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/application.yml @@ -0,0 +1,21 @@ +server: + port: ${vcap.application.port:8080} + servlet-path: /system + +cxf: + path: /services/helloservice + jaxrs: + component-scan: true + +eureka: + client: + serviceUrl: + defaultZone: ${vcap.services.eureka-service.credentials.uri:http://127.0.0.1:8761}/eureka/ + instance: + statusPageUrlPath: /system/info + healthCheckUrlPath: /system/health + +--- +spring: + profiles: cloud + http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/bootstrap.yml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/bootstrap.yml b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..64c10bc --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/bootstrap.yml @@ -0,0 +1,3 @@ +spring: + application: + name: jaxrs-hello-world-service http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/sample/rs/client/client.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/sample/rs/client/client.xml b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/sample/rs/client/client.xml new file mode 100644 index 0000000..7ba6911 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/resources/sample/rs/client/client.xml @@ -0,0 +1,33 @@ +<?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> http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/pom.xml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/pom.xml b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/pom.xml new file mode 100644 index 0000000..e6aee0b --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/pom.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-parent</artifactId> + <version>1.0.0.RELEASE</version> + </parent> + + <artifactId>eureka-registry-for-cxf</artifactId> + <groupId>org.apache.cxf.samples</groupId> + <version>3.2.0-SNAPSHOT</version> + <name>Eureka Registry for CXF SpringBoot demos</name> + <description>Eureka Registry for CXF SpringBoot demos</description> + <properties> + <start-class>registry.eureka.RegistryApplication</start-class> + </properties> + + <dependencies> + + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-eureka-server</artifactId> + </dependency> + </dependencies> + + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/src/main/java/registry/eureka/RegistryApplication.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/src/main/java/registry/eureka/RegistryApplication.java b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/src/main/java/registry/eureka/RegistryApplication.java new file mode 100644 index 0000000..2997259 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/src/main/java/registry/eureka/RegistryApplication.java @@ -0,0 +1,14 @@ +package registry.eureka; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; + +@SpringBootApplication +@EnableEurekaServer +public class RegistryApplication { + + public static void main(String[] args) { + SpringApplication.run(RegistryApplication.class, args); + } +} http://git-wip-us.apache.org/repos/asf/cxf/blob/47691ae5/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/src/main/resources/application.yml ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/src/main/resources/application.yml b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/src/main/resources/application.yml new file mode 100644 index 0000000..e5b7ab73 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/eureka-registry/src/main/resources/application.yml @@ -0,0 +1,13 @@ + + +server: + port: 8761 + + + +eureka: + client: + registerWithEureka: false + fetchRegistry: false + server: + waitTimeInMsWhenSyncEmpty: 0
