cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [1/2] cxf git commit: Adding a couple of more boot applications
Date Thu, 10 Dec 2015 14:37:10 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 304c62a11 -> c32ebfa59


Adding a couple of more boot applications


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

Branch: refs/heads/master
Commit: 07c676da560681dd711ad208c51043dd1667282b
Parents: 9ecea37
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Thu Dec 10 14:36:16 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Thu Dec 10 14:36:16 2015 +0000

----------------------------------------------------------------------
 .../samples/jax_rs/jaxrs_spring_boot/pom.xml    |  4 ++
 .../rs/service/SampleScanRestApplication.java   | 47 +++++++++++++
 .../rs/service/SampleScanRestApplication2.java  | 70 ++++++++++++++++++++
 3 files changed, 121 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/07c676da/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 ab6ddb1..e9cbd7c 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
@@ -66,6 +66,10 @@
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <mainClass>sample.rs.service.SampleRestApplication</mainClass>
+               <!-- 
+               <mainClass>sample.rs.service.SampleScanRestApplication</mainClass>
+               <mainClass>sample.rs.service.SampleScanRestApplication2</mainClass>
+               --> 
            </configuration>  
         </plugin>
         <plugin>

http://git-wip-us.apache.org/repos/asf/cxf/blob/07c676da/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication.java
b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication.java
new file mode 100644
index 0000000..c7643b2
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication.java
@@ -0,0 +1,47 @@
+/**
+ * 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.spring.SpringComponentScanServer;
+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(SpringComponentScanServer.class)
+public class SampleScanRestApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(SampleScanRestApplication.class, args);
+    }
+ 
+    @Bean
+    public ServletRegistrationBean servletRegistrationBean(ApplicationContext context) {
+        return new ServletRegistrationBean(new CXFServlet(), "/services/helloservice/*");
+    }
+ 
+    
+    @Bean
+    public HelloService helloService() {
+        return new HelloService();
+    }
+ 
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/07c676da/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication2.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication2.java
b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication2.java
new file mode 100644
index 0000000..97f3ed7
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleScanRestApplication2.java
@@ -0,0 +1,70 @@
+/**
+ * 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.Collections;
+import java.util.Set;
+
+import javax.servlet.ServletConfig;
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+
+import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet;
+import org.apache.cxf.jaxrs.spring.JaxRsConfig;
+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 SampleScanRestApplication2 {
+    public static void main(String[] args) {
+        SpringApplication.run(SampleScanRestApplication2.class, args);
+    }
+ 
+    @Bean
+    public ServletRegistrationBean servletRegistrationBean(ApplicationContext context) {
+        Application app = (Application)context.getBean("helloApp");
+        @SuppressWarnings("serial")
+        CXFNonSpringJaxrsServlet servlet = new CXFNonSpringJaxrsServlet(app) {
+            @Override
+            protected boolean isIgnoreApplicationPath(ServletConfig servletConfig) {
+                return false;
+            }
+            
+        };
+        return new ServletRegistrationBean(servlet, "/*");
+    }
+ 
+    
+    @Bean
+    public Application helloApp() {
+        return new JaxrsApplication();
+    }
+
+    @ApplicationPath("/services/helloservice")
+    public static class JaxrsApplication extends Application { 
+        public Set<Object> getSingletons() {
+            return Collections.<Object>singleton(new HelloService());
+        }
+    }
+    
+}


Mime
View raw message