Repository: cxf Updated Branches: refs/heads/master 9628872a1 -> b15472f1f
Updating jaxrs_spring_boot demo to use an interface Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b15472f1 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b15472f1 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b15472f1 Branch: refs/heads/master Commit: b15472f1f6fd0ffe35a72f56b5b843e393320dcc Parents: 9628872 Author: Sergey Beryozkin <[email protected]> Authored: Wed Jun 8 16:40:26 2016 +0100 Committer: Sergey Beryozkin <[email protected]> Committed: Wed Jun 8 16:40:26 2016 +0100 ---------------------------------------------------------------------- .../samples/jax_rs/jaxrs_spring_boot/pom.xml | 6 --- .../rs/client/SampleRestClientApplication.java | 7 ++-- .../java/sample/rs/service/HelloService.java | 37 +++++++++++++++++ .../rs/service/SampleRestApplication.java | 6 +-- .../sample/rs/service/hello1/HelloService.java | 42 -------------------- .../rs/service/hello1/HelloServiceImpl1.java | 30 ++++++++++++++ .../sample/rs/service/hello2/HelloService2.java | 42 -------------------- .../rs/service/hello2/HelloServiceImpl2.java | 32 +++++++++++++++ .../sample/rs/service/hello1/HelloService.java | 42 -------------------- .../sample/rs/service/hello2/HelloService2.java | 42 -------------------- 10 files changed, 106 insertions(+), 180 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/b15472f1/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 index 592e2f8..fa62e68 100644 --- 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 @@ -37,12 +37,6 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>cglib</groupId> - <artifactId>cglib-nodep</artifactId> - <version>2.2.2</version> - </dependency> - </dependencies> <build> <plugins> http://git-wip-us.apache.org/repos/asf/cxf/blob/b15472f1/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 index f015097..448861c 100644 --- 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 @@ -20,7 +20,7 @@ package sample.rs.client; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; -import sample.rs.service.hello1.HelloService; +import sample.rs.service.HelloService; public final class SampleRestClientApplication { @@ -28,8 +28,9 @@ public final class SampleRestClientApplication { } public static void main(String[] args) { - HelloService service = JAXRSClientFactory.create("http://localhost:8080/services/helloservice/", - HelloService.class); + HelloService service = + JAXRSClientFactory.create("http://localhost:8080/services/helloservice/", + HelloService.class); System.out.println(service.sayHello("ApacheCxfUser")); } } http://git-wip-us.apache.org/repos/asf/cxf/blob/b15472f1/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 new file mode 100644 index 0000000..bd37a96 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/jaxrs_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/b15472f1/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 index d2d241e..f739e95 100644 --- 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 @@ -28,8 +28,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; -import sample.rs.service.hello1.HelloService; -import sample.rs.service.hello2.HelloService2; +import sample.rs.service.hello1.HelloServiceImpl1; +import sample.rs.service.hello2.HelloServiceImpl2; @SpringBootApplication public class SampleRestApplication { @@ -44,7 +44,7 @@ public class SampleRestApplication { public Server rsServer() { JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); endpoint.setBus(bus); - endpoint.setServiceBeans(Arrays.asList(new HelloService(), new HelloService2())); + 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/b15472f1/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello1/HelloService.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello1/HelloService.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello1/HelloService.java deleted file mode 100644 index 6672ecb..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello1/HelloService.java +++ /dev/null @@ -1,42 +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 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; - -import io.swagger.annotations.Api; - -@Path("/sayHello") -@Service -@Api("/sayHello") -public class HelloService { - - @GET - @Path("/{a}") - @Produces(MediaType.TEXT_PLAIN) - public String sayHello(@PathParam("a") String a) { - return "Hello " + a + ", Welcome to CXF RS Spring Boot World!!!"; - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/b15472f1/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 new file mode 100644 index 0000000..0e5d9b8 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/jaxrs_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/b15472f1/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello2/HelloService2.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello2/HelloService2.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello2/HelloService2.java deleted file mode 100644 index 874e363..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/hello2/HelloService2.java +++ /dev/null @@ -1,42 +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.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; - -import io.swagger.annotations.Api; - -@Path("/sayHello2") -@Service -@Api("/sayHello2") -public class HelloService2 { - - @GET - @Path("/{a}") - @Produces(MediaType.TEXT_PLAIN) - public String sayHello(@PathParam("a") String a) { - return "Hello2 " + a + ", Welcome to CXF RS Spring Boot World!!!"; - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/b15472f1/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 new file mode 100644 index 0000000..9b24c29 --- /dev/null +++ b/distribution/src/main/release/samples/jax_rs/jaxrs_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/b15472f1/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello1/HelloService.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello1/HelloService.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello1/HelloService.java deleted file mode 100644 index 6672ecb..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello1/HelloService.java +++ /dev/null @@ -1,42 +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 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; - -import io.swagger.annotations.Api; - -@Path("/sayHello") -@Service -@Api("/sayHello") -public class HelloService { - - @GET - @Path("/{a}") - @Produces(MediaType.TEXT_PLAIN) - public String sayHello(@PathParam("a") String a) { - return "Hello " + a + ", Welcome to CXF RS Spring Boot World!!!"; - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/b15472f1/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello2/HelloService2.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello2/HelloService2.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello2/HelloService2.java deleted file mode 100644 index 874e363..0000000 --- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot_scan/src/main/java/sample/rs/service/hello2/HelloService2.java +++ /dev/null @@ -1,42 +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.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; - -import io.swagger.annotations.Api; - -@Path("/sayHello2") -@Service -@Api("/sayHello2") -public class HelloService2 { - - @GET - @Path("/{a}") - @Produces(MediaType.TEXT_PLAIN) - public String sayHello(@PathParam("a") String a) { - return "Hello2 " + a + ", Welcome to CXF RS Spring Boot World!!!"; - } - -}
