You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2015/12/10 14:16:06 UTC
cxf git commit: Updates to JAXRS Spring Boot demo
Repository: cxf
Updated Branches:
refs/heads/master e128184f0 -> 9ecea3759
Updates to JAXRS Spring Boot demo
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9ecea375
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9ecea375
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9ecea375
Branch: refs/heads/master
Commit: 9ecea375930d1a217f35da65e0d6073f7a80bf7d
Parents: e128184
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Thu Dec 10 13:15:49 2015 +0000
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Thu Dec 10 13:15:49 2015 +0000
----------------------------------------------------------------------
.../samples/jax_rs/jaxrs_spring_boot/pom.xml | 72 ++++----------------
.../rs/service/SampleRestApplication.java | 52 ++++++++++++++
.../rs/service/SampleRestWSApplication.java | 62 -----------------
3 files changed, 67 insertions(+), 119 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/9ecea375/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 7e3af7d..ab6ddb1 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
@@ -1,19 +1,17 @@
<?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>
+ <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
- </parent>
+ </parent>
<artifactId>spring-boot-sample-rs-cxf</artifactId>
- <version>1.2.3.RELEASE</version>
- <name>Spring Boot Web Services Sample</name>
- <description>Spring Boot CXF Restful Web Services Sample</description>
- <url>http://projects.spring.io/spring-boot/</url>
+ <name>Spring Boot CXF REST Application</name>
+ <description>Spring Boot CXF REST Application</description>
+
<properties>
<cxf.version>3.2.0-SNAPSHOT</cxf.version>
- <jackson.version>2.3.0</jackson.version>
<jetty.version>8.1.5.v20120716</jetty.version>
</properties>
<dependencies>
@@ -55,68 +53,28 @@
</dependency>
<dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.jaxrs</groupId>
- <artifactId>jackson-jaxrs-json-provider</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlets</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
- <version>1.2.3.RELEASE</version>
+ <version>1.2.3.RELEASE</version>
</dependency>
</dependencies>
<build>
- <plugins>
+ <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.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <configuration>
- <mainClass>sample.rs.service.SampleRestWSApplication</mainClass>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>sample.rs.client.SampleRestClientApplication</mainClass>
</configuration>
</plugin>
- </plugins>
+ </plugins>
</build>
</project>
http://git-wip-us.apache.org/repos/asf/cxf/blob/9ecea375/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
new file mode 100644
index 0000000..81df51b
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java
@@ -0,0 +1,52 @@
+/**
+ * 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.endpoint.Server;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.spring.JaxRsConfig;
+import org.apache.cxf.transport.servlet.CXFServlet;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.embedded.ServletRegistrationBean;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Import;
+
+@SpringBootApplication
+@Import(JaxRsConfig.class)
+public class SampleRestApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(SampleRestApplication.class, args);
+ }
+
+ @Bean
+ public ServletRegistrationBean servletRegistrationBean(ApplicationContext context) {
+ return new ServletRegistrationBean(new CXFServlet(), "/services/*");
+ }
+
+
+ @Bean
+ public Server rsServer() {
+ JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
+ endpoint.setServiceBean(new HelloService());
+ endpoint.setAddress("/helloservice");
+ return endpoint.create();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/9ecea375/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestWSApplication.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestWSApplication.java b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestWSApplication.java
deleted file mode 100644
index 7a78392..0000000
--- a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestWSApplication.java
+++ /dev/null
@@ -1,62 +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.Bus;
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
-import org.apache.cxf.jaxrs.spring.JaxRsConfig;
-import org.apache.cxf.transport.servlet.CXFServlet;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.context.embedded.ServletRegistrationBean;
-import org.springframework.boot.context.web.SpringBootServletInitializer;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Import;
-
-@SpringBootApplication
-@Import(JaxRsConfig.class)
-public class SampleRestWSApplication {
-
- @Autowired
- private ApplicationContext applicationContext;
-
- public static void main(String[] args) {
- SpringApplication.run(SampleRestWSApplication.class, args);
- }
-
- @Bean
- public ServletRegistrationBean servletRegistrationBean(ApplicationContext context) {
- return new ServletRegistrationBean(new CXFServlet(), "/services/*");
- }
-
-
- @Bean
- public Server rsServer() {
- Bus bus = (Bus) applicationContext.getBean(Bus.DEFAULT_BUS_ID);
- JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
- endpoint.setServiceBean(new HelloService());
- endpoint.setAddress("/helloservice");
- endpoint.setBus(bus);
- return endpoint.create();
- }
-
-}