juneau-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] jamesbognar closed pull request #22: Create project to integration Juneau + Spring boot
Date Sat, 01 Dec 2018 21:58:43 GMT
jamesbognar closed pull request #22: Create project to integration Juneau + Spring boot
URL: https://github.com/apache/juneau/pull/22
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.gitignore b/.gitignore
index 53803437a..ba97f8da2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
 **/.DS_Store
 target
-**/.settings
-
+derby.log
+.idea/
+*.iml
+**/.settings
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-rest-springboot/juneau-examples-rest-springboot.launch b/juneau-examples/juneau-examples-rest-springboot/juneau-examples-rest-springboot.launch
index 9585eedb5..5d901f2f1 100644
--- a/juneau-examples/juneau-examples-rest-springboot/juneau-examples-rest-springboot.launch
+++ b/juneau-examples/juneau-examples-rest-springboot/juneau-examples-rest-springboot.launch
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/juneau-microservice-server/src/main/java/org/apache/juneau/examples/rest/springboot/App.java"/>
+<listEntry value="/juneau-microservice-server/src/main/java/org/apache/juneau/examples/rest/springboot/AppStart.java"/>
 </listAttribute>
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
 <listEntry value="1"/>
@@ -11,7 +11,7 @@
 <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
 <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
 <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.juneau.examples.rest.springboot.App"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.juneau.examples.rest.springboot.AppStart"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="examples.cfg"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="juneau-examples-rest-springboot"/>
 <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
diff --git a/juneau-examples/juneau-examples-rest-springboot/pom.xml b/juneau-examples/juneau-examples-rest-springboot/pom.xml
index d28ccf55f..31547e067 100644
--- a/juneau-examples/juneau-examples-rest-springboot/pom.xml
+++ b/juneau-examples/juneau-examples-rest-springboot/pom.xml
@@ -13,88 +13,124 @@
  * specific language governing permissions and limitations under the License.                                              *
  ***************************************************************************************************************************
 -->
-<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">
+<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>
+    <modelVersion>4.0.0</modelVersion>
 
-	<parent>
-		<groupId>org.apache.juneau</groupId>
-		<artifactId>juneau-examples</artifactId>
-		<version>8.0.0-SNAPSHOT</version>
-	</parent>
+    <parent>
+        <groupId>org.apache.juneau</groupId>
+        <artifactId>juneau-examples</artifactId>
+        <version>8.0.0-SNAPSHOT</version>
+    </parent>
 
-	<artifactId>juneau-examples-rest-springboot</artifactId>
-	<name>Apache Juneau REST Examples using Spring Boot</name>
-	<description>Sample code deployed using Spring Boot.</description>
+    <artifactId>juneau-examples-rest-springboot</artifactId>
+    <name>Apache Juneau REST Examples using Spring Boot</name>
+    <description>Sample code deployed using Spring Boot.</description>
 
-	<properties>
-		<encoding>UTF-8</encoding>
+    <properties>
+        <encoding>UTF-8</encoding>
+        <maven.javadoc.skip>true</maven.javadoc.skip>
 
-		<!-- Skip javadoc generation since we generate them in the aggregate pom -->
-		<maven.javadoc.skip>true</maven.javadoc.skip>
+        <!-- Skip javadoc generation since we generate them in the aggregate pom -->
+        <maven.javadoc.skip>true</maven.javadoc.skip>
 
-	</properties>
+        <!-- Java 8 required because Jetty requires it. -->
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+        <springframework.version>2.0.1.RELEASE</springframework.version>
+    </properties>
 
 
-	<dependencies>
-		<!-- Juneau dependencies -->
-		<dependency>
-			<groupId>org.apache.juneau</groupId>
-			<artifactId>juneau-examples-rest</artifactId>
-			<version>${project.version}</version>
-		</dependency>
+    <dependencies>
+        <!-- Juneau dependencies -->
+        <dependency>
+            <groupId>org.apache.juneau</groupId>
+            <artifactId>juneau-examples-rest</artifactId>
+            <version>${project.version}</version>
+        </dependency>
 
-		<!-- Spring Boot dependencies-->
-		<dependency>
-		    <groupId>org.springframework.boot</groupId>
-		    <artifactId>spring-boot-starter-web</artifactId>
-			<version>${springframework.version}</version>
-			<exclusions>
-				<exclusion>
-					<groupId>org.springframework.boot</groupId>
-					<artifactId>spring-boot-starter-logging</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-	</dependencies>
+        <dependency>
+            <groupId>org.apache.juneau</groupId>
+            <artifactId>juneau-microservice-server-springboot</artifactId>
+            <version>${project.version}</version>
+        </dependency>
 
-	<build>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-source-plugin</artifactId>
-				<executions>
-					<execution>
-						<id>attach-sources</id>
-						<phase>verify</phase>
-						<goals>
-							<goal>jar-no-fork</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
+        <!-- Spring Boot dependencies-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <version>${springframework.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-logging</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>jar-no-fork</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <escapeString>\</escapeString>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>juneau-assembly</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <finalName>juneau-examples-rest-springboot-${project.version}</finalName>
+                            <descriptors>
+                                <descriptor>src/assembly/bin.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <distributionManagement>
+        <repository>
+            <id>apache.releases.https</id>
+            <name>Apache Release Distribution Repository</name>
+            <url>https://repository.apache.org/service/local/staging/deploy/maven2</url>
+        </repository>
+        <snapshotRepository>
+            <id>apache.snapshots.https</id>
+            <name>Apache Development Snapshot Repository</name>
+            <url>https://repository.apache.org/content/repositories/snapshots</url>
+        </snapshotRepository>
+    </distributionManagement>
 
-			<plugin>
-				<artifactId>maven-assembly-plugin</artifactId>
-				<configuration>
-					<escapeString>\</escapeString>
-				</configuration>
-				<executions>
-					<execution>
-						<id>juneau-assembly</id>
-						<phase>package</phase>
-						<goals>
-							<goal>single</goal>
-						</goals>
-						<configuration>
-							<finalName>juneau-examples-rest-springboot-${project.version}</finalName>
-							<descriptors>
-								<descriptor>src/assembly/bin.xml</descriptor>
-							</descriptors>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
-		</plugins>
-	</build>
 </project>
diff --git a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/AppServletConfiguration.java b/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/AppServletConfiguration.java
deleted file mode 100644
index c93564fc7..000000000
--- a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/AppServletConfiguration.java
+++ /dev/null
@@ -1,49 +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 org.apache.juneau.examples.rest.springboot;
-
-import org.apache.juneau.examples.rest.*;
-import org.apache.juneau.rest.*;
-import org.springframework.boot.web.servlet.*;
-import org.springframework.context.annotation.*;
-import org.springframework.web.filter.*;
-
-/**
- * Spring configuration for servlets.
- */
-@Configuration
-public class AppServletConfiguration {
-
-	private static final String CONTEXT_ROOT = "";
-
-	@Bean
-	public RootResources root(RestResourceResolver resolver) {
-		return (RootResources)new RootResources().setRestResourceResolver(resolver);
-	}
-
-	@Bean
-	public ServletRegistrationBean<RootResources> rootRegistration(RootResources root) {
-		return new ServletRegistrationBean<>(root, CONTEXT_ROOT, CONTEXT_ROOT+"/", CONTEXT_ROOT+"/"+root.getPath());
-	}
-
-	/**
-	 * We want to be able to consume url-encoded-form-post bodies, but HiddenHttpMethodFilter triggers the HTTP
-	 * body to be consumed.  So disable it.
-	 */
-	@Bean
-	public FilterRegistrationBean<HiddenHttpMethodFilter> registration(HiddenHttpMethodFilter filter) {
-	    FilterRegistrationBean<HiddenHttpMethodFilter> registration = new FilterRegistrationBean<>(filter);
-	    registration.setEnabled(false);
-	    return registration;
-	}
-}
diff --git a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java b/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/AppStart.java
similarity index 57%
rename from juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java
rename to juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/AppStart.java
index 416865527..8abab75a8 100644
--- a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java
+++ b/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/AppStart.java
@@ -12,42 +12,49 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.examples.rest.springboot;
 
-import static org.apache.juneau.internal.SystemUtils.*;
-
+import org.apache.juneau.examples.rest.RootResources;
+import org.apache.juneau.microservice.springboot.annotations.EnabledJuneauIntegration;
 import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.*;
-import org.springframework.context.*;
-import org.springframework.context.annotation.*;
-import org.springframework.stereotype.*;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * Entry point for Examples REST application when deployed as a Spring Boot application.
  */
 @SpringBootApplication
+@EnabledJuneauIntegration(rootResources = RootResources.class)
 @Controller
-@Import({AppConfiguration.class, AppServletConfiguration.class})
-public class App {
+@RestController
+public class AppStart {
+
+    public static int counter = 0;
+    private static volatile ConfigurableApplicationContext context;
 
-	private static volatile ConfigurableApplicationContext context;
+    @GetMapping(value = "/status")
+    public String status() {
+        return "ok";
+    }
 
-	public static void main(String[] args) {
-		try {
-			setProperty("juneau.configFile", "examples.cfg", false);
-			context = SpringApplication.run(App.class, args);
-			if (context == null)
-				System.exit(2); // Probably port in use?
-			AppConfiguration.setAppContext(context);
-			setProperty("juneau.serverPort", context.getEnvironment().getProperty("server.port"), false);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
+    public static void main(String[] args) {
+        if (System.getProperty("juneau.configFile") == null)
+            System.setProperty("juneau.configFile", "examples.cfg");
+        try {
+            context = SpringApplication.run(AppStart.class, args);
+            if (context == null)
+                System.exit(2); // Probably port in use?
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 
-	public static void start() {
-		main(new String[0]);
-	}
+    public static void start() {
+        main(new String[0]);
+    }
 
-	public static void stop() {
-		context.stop();
-	}
+    public static void stop() {
+        context.stop();
+    }
 }
diff --git a/juneau-examples/juneau-examples-rest-springboot/src/main/resources/log4j.xml b/juneau-examples/juneau-examples-rest-springboot/src/main/resources/log4j.xml
new file mode 100644
index 000000000..18b0d7c59
--- /dev/null
+++ b/juneau-examples/juneau-examples-rest-springboot/src/main/resources/log4j.xml
@@ -0,0 +1,31 @@
+<?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.                                              *
+ ***************************************************************************************************************************
+-->
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+    <appender name="console" class="org.apache.log4j.ConsoleAppender">
+        <param name="Target" value="System.out"/>
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n"/>
+        </layout>
+    </appender>
+
+    <root>
+        <priority value="INFO"/>
+        <appender-ref ref="console"/>
+    </root>
+
+</log4j:configuration>
\ No newline at end of file
diff --git a/juneau-examples/juneau-examples-rest/pom.xml b/juneau-examples/juneau-examples-rest/pom.xml
index a87c1b81c..ebf5e746e 100644
--- a/juneau-examples/juneau-examples-rest/pom.xml
+++ b/juneau-examples/juneau-examples-rest/pom.xml
@@ -77,6 +77,13 @@
 		    <version>${xml.apis.version}</version>
 		</dependency>
 
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>javax.servlet-api</artifactId>
+			<version>3.1.0</version>
+			<scope>compile</scope>
+		</dependency>
+
 		<dependency>
 			<groupId>javax.inject</groupId>
 			<artifactId>javax.inject</artifactId>
diff --git a/juneau-microservice/juneau-microservice-server-springboot/pom.xml b/juneau-microservice/juneau-microservice-server-springboot/pom.xml
new file mode 100644
index 000000000..ad31769e6
--- /dev/null
+++ b/juneau-microservice/juneau-microservice-server-springboot/pom.xml
@@ -0,0 +1,102 @@
+<?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.                                              *
+ ***************************************************************************************************************************
+-->
+<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.apache.juneau</groupId>
+        <artifactId>juneau-microservice</artifactId>
+        <version>8.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>juneau-microservice-server-springboot</artifactId>
+    <name>Apache Juneau Microservice Server - Spring Boot</name>
+    <description>API for creating standalone executable jars that can be used to start lightweight configurable REST
+        interfaces.
+    </description>
+
+    <properties>
+        <encoding>UTF-8</encoding>
+        <maven.javadoc.skip>true</maven.javadoc.skip>
+
+        <!-- Skip javadoc generation since we generate them in the aggregate pom -->
+        <maven.javadoc.skip>true</maven.javadoc.skip>
+
+        <!-- Java 8 required because Jetty requires it. -->
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+        <springframework.version>2.0.1.RELEASE</springframework.version>
+    </properties>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.juneau</groupId>
+            <artifactId>juneau-microservice-server</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <!-- Spring Boot dependencies-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <version>${springframework.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-logging</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>jar-no-fork</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <distributionManagement>
+        <repository>
+            <id>apache.releases.https</id>
+            <name>Apache Release Distribution Repository</name>
+            <url>https://repository.apache.org/service/local/staging/deploy/maven2</url>
+        </repository>
+        <snapshotRepository>
+            <id>apache.snapshots.https</id>
+            <name>Apache Development Snapshot Repository</name>
+            <url>https://repository.apache.org/content/repositories/snapshots</url>
+        </snapshotRepository>
+    </distributionManagement>
+</project>
diff --git a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/SpringRestResourceResolver.java b/juneau-microservice/juneau-microservice-server-springboot/src/main/java/org/apache/juneau/microservice/springboot/annotations/EnabledJuneauIntegration.java
similarity index 67%
rename from juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/SpringRestResourceResolver.java
rename to juneau-microservice/juneau-microservice-server-springboot/src/main/java/org/apache/juneau/microservice/springboot/annotations/EnabledJuneauIntegration.java
index 1a12c1cf4..a62e726fb 100644
--- a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/SpringRestResourceResolver.java
+++ b/juneau-microservice/juneau-microservice-server-springboot/src/main/java/org/apache/juneau/microservice/springboot/annotations/EnabledJuneauIntegration.java
@@ -10,31 +10,21 @@
 // * "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 org.apache.juneau.examples.rest.springboot;
+package org.apache.juneau.microservice.springboot.annotations;
 
-import org.apache.juneau.rest.*;
-import org.springframework.context.ApplicationContext;
+import org.apache.juneau.microservice.BasicRestServletJenaGroup;
+import org.apache.juneau.microservice.springboot.config.AppConfiguration;
+import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
+import org.springframework.stereotype.Component;
 
-/**
- * Implementation of a {@link RestResourceResolver} for resolving REST resources using Spring.
- */
-public class SpringRestResourceResolver extends BasicRestResourceResolver {
+import java.lang.annotation.*;
 
-	private ApplicationContext appContext;
-
-	public SpringRestResourceResolver(ApplicationContext appContext) {
-		this.appContext = appContext;
-	}
-
-	@Override
-	public <T> T resolve(Object parent, Class<T> type, RestContextBuilder builder, Object...args) {
-		try {
-			T o = appContext.getBean(type);
-			if (o != null)
-				return o;
-		} catch (Exception e) {
-			// Ignore
-		}
-		return super.resolve(parent, type, builder);
-	}
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@Inherited
+@Component
+@ImportAutoConfiguration(classes = AppConfiguration.class)
+public @interface EnabledJuneauIntegration {
+    Class<? extends BasicRestServletJenaGroup> rootResources();
 }
diff --git a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/AppConfiguration.java b/juneau-microservice/juneau-microservice-server-springboot/src/main/java/org/apache/juneau/microservice/springboot/config/JuneauApplicationContextInitializer.java
similarity index 64%
rename from juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/AppConfiguration.java
rename to juneau-microservice/juneau-microservice-server-springboot/src/main/java/org/apache/juneau/microservice/springboot/config/JuneauApplicationContextInitializer.java
index e41b49370..13f5f075d 100644
--- a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/AppConfiguration.java
+++ b/juneau-microservice/juneau-microservice-server-springboot/src/main/java/org/apache/juneau/microservice/springboot/config/JuneauApplicationContextInitializer.java
@@ -10,33 +10,22 @@
 // * "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 org.apache.juneau.examples.rest.springboot;
+package org.apache.juneau.microservice.springboot.config;
 
-import org.apache.juneau.rest.RestResourceResolver;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
+import org.apache.juneau.microservice.springboot.annotations.EnabledJuneauIntegration;
+import org.springframework.context.ApplicationContextInitializer;
+import org.springframework.context.ConfigurableApplicationContext;
 
-/**
- * Spring configuration for Spring beans.
- */
-@Configuration
-public abstract class AppConfiguration {
+public class JuneauApplicationContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
 
-	@Autowired
-	private static volatile ApplicationContext appContext;
+    private Class appClass;
 
-	public static ApplicationContext getAppContext() {
-		return appContext;
-	}
+    public JuneauApplicationContextInitializer(Class appClass) {
+        this.appClass = appClass;
+    }
 
-	public static void setAppContext(ApplicationContext appContext) {
-		AppConfiguration.appContext = appContext;
-	}
-
-	@Bean
-	public RestResourceResolver restResourceResolver(ApplicationContext appContext) {
-		return new SpringRestResourceResolver(appContext);
-	}
-}
+    @Override
+    public void initialize(ConfigurableApplicationContext applicationContext) {
+        applicationContext.addBeanFactoryPostProcessor(new ServletConfiguration((EnabledJuneauIntegration) appClass.getAnnotation(EnabledJuneauIntegration.class)));
+    }
+}
\ No newline at end of file
diff --git a/juneau-microservice/juneau-microservice-server-springboot/src/main/java/org/apache/juneau/microservice/springboot/config/ServletConfiguration.java b/juneau-microservice/juneau-microservice-server-springboot/src/main/java/org/apache/juneau/microservice/springboot/config/ServletConfiguration.java
new file mode 100644
index 000000000..bacf64990
--- /dev/null
+++ b/juneau-microservice/juneau-microservice-server-springboot/src/main/java/org/apache/juneau/microservice/springboot/config/ServletConfiguration.java
@@ -0,0 +1,74 @@
+// ***************************************************************************************************************************
+// * 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 org.apache.juneau.microservice.springboot.config;
+
+import org.apache.juneau.microservice.springboot.annotations.EnabledJuneauIntegration;
+import org.apache.juneau.rest.RestServlet;
+import org.apache.juneau.rest.annotation.RestResource;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
+import org.springframework.beans.factory.support.RootBeanDefinition;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+
+import javax.servlet.Servlet;
+
+public class ServletConfiguration implements BeanDefinitionRegistryPostProcessor {
+
+    private EnabledJuneauIntegration annotation = null;
+
+    public ServletConfiguration(EnabledJuneauIntegration annotation) {
+        this.annotation = annotation;
+    }
+
+    @Override
+    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
+
+        if (annotation.rootResources() == null) {
+            return;
+        }
+
+        for (Class clazz : annotation.rootResources()) {
+
+            RestServlet restServlet = createServlet(clazz);
+            RestResource restResource = restServlet.getClass().getAnnotation(RestResource.class);
+            registerServlet(registry, restServlet, restResource);
+        }
+
+    }
+
+    private void registerServlet(BeanDefinitionRegistry registry, Servlet restServlet, RestResource restResource) {
+        ServletRegistrationBean registration = new ServletRegistrationBean(restServlet, restResource.path());
+        registry.registerBeanDefinition(registration.getServletName(), new RootBeanDefinition(ServletRegistrationBean.class,
+                () -> registration));
+
+    }
+
+    private RestServlet createServlet(Class clazz) {
+        try {
+            return (RestServlet) clazz.newInstance();
+        } catch (InstantiationException e) {
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        }
+
+        return null;
+    }
+
+    @Override
+    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
+
+    }
+}
diff --git a/juneau-microservice/pom.xml b/juneau-microservice/pom.xml
index 0e44ef154..3382f723d 100644
--- a/juneau-microservice/pom.xml
+++ b/juneau-microservice/pom.xml
@@ -32,6 +32,7 @@
 		<module>juneau-microservice-server</module>
 		<module>juneau-microservice-template</module>
 		<module>juneau-microservice-test</module>
+		<module>juneau-microservice-server-springboot</module>
 	</modules>
 
 </project>
diff --git a/pom-sonar.xml b/pom-sonar.xml
new file mode 100644
index 000000000..225fde58a
--- /dev/null
+++ b/pom-sonar.xml
@@ -0,0 +1,392 @@
+<?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.                                              *
+ ***************************************************************************************************************************
+-->
+<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>
+
+    <groupId>org.apache.juneau</groupId>
+    <artifactId>juneau</artifactId>
+    <version>8.0.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+    <name>Apache Juneau</name>
+    <description>All the Apache Juneau content in one convenient package.</description>
+
+    <parent>
+        <groupId>org.apache</groupId>
+        <artifactId>apache</artifactId>
+        <version>21</version>
+    </parent>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <jena.version>2.7.1</jena.version>
+        <junit.version>4.11</junit.version>
+        <jaxrs.version>1.1.1</jaxrs.version>
+        <servlet.version>3.1.0</servlet.version>
+        <httpclient.version>4.5.6</httpclient.version>
+        <jetty.version>9.4.13.v20181111</jetty.version>
+        <juneau.compare.version>8.0.0</juneau.compare.version>
+        <javadoc.juneau.version>8.0.0</javadoc.juneau.version>
+        <juneauVersion>8.0.0</juneauVersion>
+        <juneauVersionNext>8.0.1</juneauVersionNext>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.jena</groupId>
+                <artifactId>jena-core</artifactId>
+                <version>${jena.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>${junit.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>javax.ws.rs</groupId>
+                <artifactId>jsr311-api</artifactId>
+                <version>${jaxrs.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>javax.servlet</groupId>
+                <artifactId>javax.servlet-api</artifactId>
+                <version>${servlet.version}</version>
+                <scope>provided</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.httpcomponents</groupId>
+                <artifactId>httpclient</artifactId>
+                <version>${httpclient.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.httpcomponents</groupId>
+                <artifactId>httpmime</artifactId>
+                <version>${httpclient.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.github.siom79.japicmp</groupId>
+                <artifactId>japicmp</artifactId>
+                <version>0.13.0</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <modules>
+        <module>juneau-core</module>
+        <module>juneau-rest</module>
+        <module>juneau-microservice</module>
+        <module>juneau-examples</module>
+        <module>juneau-doc</module>
+        <module>juneau-releng</module>
+    </modules>
+
+    <distributionManagement>
+        <!-- Uncomment to generate Maven site in /tmp/site -->
+        <!--site>
+            <id>${project.artifactId}-site</id>
+            <url>file:///tmp/site</url>
+        </site-->
+    </distributionManagement>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-enforcer-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>enforce-maven</id>
+                        <goals>
+                            <goal>enforce</goal>
+                        </goals>
+                        <configuration>
+                            <rules>
+                                <requireMavenVersion>
+                                    <!-- ! Maven minimum 3.2.0 to build. -->
+                                    <version>3.2.0</version>
+                                </requireMavenVersion>
+                            </rules>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <!--
+                Runs Apache Rat against all source code to make sure all files have licenses.
+            -->
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <!--
+                    ! Can be removed if updated to asf parent version 19.
+                -->
+                <configuration>
+                    <excludes>
+                        <exclude>**/DEPENDENCIES</exclude>
+                        <exclude>**/target/**</exclude>
+
+                        <!-- Eclipse metadata files -->
+                        <exclude>**/.settings/**</exclude>
+                        <exclude>**/.project</exclude>
+                        <exclude>**/.classpath</exclude>
+                        <exclude>**/*.launch</exclude>
+
+                        <!-- Generated by embedded jetty server -->
+                        <exclude>**/jetty.out.xml</exclude>
+
+                        <!-- Generated in juneau-microservice-template for some reason -->
+                        <exclude>**/dependency-reduced-pom.xml</exclude>
+
+                        <!-- Generated by juneau-docs.jar -->
+                        <exclude>**/docs.txt</exclude>
+
+                        <!-- Files needed by Heroku as-is -->
+                        <exclude>**/app.json</exclude>
+                        <exclude>**/Procfile</exclude>
+                    </excludes>
+                    <consoleOutput>true</consoleOutput>
+                    <!-- Note:  useEclipseDefaultExcludes does not work for subprojects.  See RAT-107 -->
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+
+        <pluginManagement>
+            <plugins>
+
+                <!-- Generates the javadocs for all non-test projects. -->
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-javadoc-plugin</artifactId>
+                    <version>2.10.4</version>
+                    <configuration>
+                        <additionalJOptions>
+                            <additionalJOption>-J-DjuneauVersion=${juneauVersion}</additionalJOption>
+                            <additionalJOption>-J-DjuneauVersionNext=${juneauVersionNext}</additionalJOption>
+                        </additionalJOptions>
+                        <show>protected</show>
+                        <windowtitle>${project.name} ${project.version}</windowtitle>
+                        <author>true</author>
+                        <linksource>true</linksource>
+                        <source>1.8</source>
+                        <bootclasspath>${sun.boot.class.path}</bootclasspath>
+                        <overview>${basedir}/juneau-doc/src/main/javadoc/overview.html</overview>
+                        <stylesheetfile>${basedir}/juneau-doc/src/main/javadoc/javadoc.css</stylesheetfile>
+                        <use>false</use>
+                        <additionalparam>-sourcetab 3 -notimestamp -Xdoclint:none --allow-script-in-comments</additionalparam>
+                        <verbose>false</verbose>
+                        <excludePackageNames>*proto*:*samples*:*examples*:*test*:org.apache.juneau.doc.internal</excludePackageNames>
+                        <linksource>true</linksource>
+                        <links>
+                            <link>http://docs.oracle.com/javase/8/docs/api/</link>
+                            <link>http://docs.oracle.com/javaee/5/api/</link>
+                        </links>
+                        <docfilessubdirs>true</docfilessubdirs>
+                        <javadocDirectory>${basedir}/juneau-doc/src/main/javadoc</javadocDirectory>
+                        <taglets>
+                            <taglet>
+                                <tagletClass>org.apache.juneau.doc.internal.DocTag</tagletClass>
+                                <tagletpath>${basedir}/juneau-doc/juneau-doc.jar</tagletpath>
+                            </taglet>
+                            <taglet>
+                                <tagletClass>org.apache.juneau.doc.internal.PropertyTag</tagletClass>
+                                <tagletpath>${basedir}/juneau-doc/juneau-doc.jar</tagletpath>
+                            </taglet>
+
+                            <!--org.apache.juneau.doc.internal.DocTag</taglet-->
+                            <!-- taglet>org.apache.juneau.doc.internal.PropertyTag</taglet-->
+                        </taglets>
+                        <tagletpath>${basedir}/juneau-doc/juneau-doc.jar</tagletpath>
+                    </configuration>
+                    <executions>
+                        <execution>
+                            <id>attach-javadocs</id>
+                            <goals>
+                                <goal>jar</goal>
+                            </goals>
+                        </execution>
+                        <execution>
+                            <id>aggregate</id>
+                            <phase>site</phase>
+                            <goals>
+                                <goal>aggregate</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+
+                <plugin>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <configuration>
+                        <source>1.8</source>
+                        <target>1.8</target>
+                    </configuration>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.eclipse.m2e</groupId>
+                    <artifactId>lifecycle-mapping</artifactId>
+                    <version>1.0.0</version>
+                    <configuration>
+                        <lifecycleMappingMetadata>
+                            <pluginExecutions>
+                                <pluginExecution>
+                                    <pluginExecutionFilter>
+                                        <groupId>org.apache.maven.plugins</groupId>
+                                        <artifactId>maven-remote-resources-plugin</artifactId>
+                                        <versionRange>[1.0,)</versionRange>
+                                        <goals>
+                                            <goal>process</goal>
+                                        </goals>
+                                    </pluginExecutionFilter>
+                                    <action>
+                                        <ignore>
+                                        </ignore>
+                                    </action>
+                                </pluginExecution>
+                            </pluginExecutions>
+                        </lifecycleMappingMetadata>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.10.4</version>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jxr-plugin</artifactId>
+                <version>2.5</version>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-report-plugin</artifactId>
+                <version>2.18</version>
+                <configuration>
+                    <aggregate>true</aggregate>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.sonarsource.scanner.maven</groupId>
+                <artifactId>sonar-maven-plugin</artifactId>
+                <version>3.2</version>
+            </plugin>
+            <plugin>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+                <version>0.7.2.201409121644</version>
+                <configuration>
+                    <fileSets>
+                        <fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">
+                            <directory>${project.parent.build.directory}</directory>
+                            <includes>
+                                <include>*.exec</include>
+                            </includes>
+                        </fileSet>
+                    </fileSets>
+                </configuration>
+            </plugin>
+        </plugins>
+    </reporting>
+
+    <url>http://juneau.apache.org</url>
+    <organization>
+        <name>Apache</name>
+        <url>http://www.apache.org/</url>
+    </organization>
+    <scm>
+        <connection>scm:git:https://gitbox.apache.org/repos/asf/juneau.git</connection>
+        <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/juneau.git</developerConnection>
+        <url>https://github.com/apache/juneau</url>
+        <tag>HEAD</tag>
+    </scm>
+    <issueManagement>
+        <system>Jira</system>
+        <url>https://issues.apache.org/jira/browse/JUNEAU</url>
+    </issueManagement>
+    <mailingLists>
+        <mailingList>
+            <name>Apache Juneau Developers</name>
+            <post>dev@juneau.apache.org</post>
+            <subscribe>list-subscribe@juneau.apache.org</subscribe>
+            <unsubscribe>list-unsubscribe@juneau.apache.org</unsubscribe>
+            <archive>https://lists.apache.org/list.html?dev@juneau.apache.org</archive>
+        </mailingList>
+    </mailingLists>
+    <developers>
+        <developer>
+            <id>johnadament</id>
+            <name>John D. Ament</name>
+            <roles><role>PMC</role></roles>
+        </developer>
+        <developer>
+            <id>sblackmon</id>
+            <name>Steve Blackmon</name>
+            <roles><role>PMC</role></roles>
+        </developer>
+        <developer>
+            <id>clr</id>
+            <name>Craig L Russell</name>
+            <roles><role>PMC</role></roles>
+        </developer>
+        <developer>
+            <id>stain</id>
+            <name>Stian Soiland-Reyes</name>
+            <roles><role>PMC</role></roles>
+        </developer>
+        <developer>
+            <id>jochen</id>
+            <name>Jochen Wiedmann</name>
+            <roles><role>PMC</role></roles>
+        </developer>
+        <developer>
+            <id>jamesbognar</id>
+            <name>James Bognar</name>
+            <roles><role>PMC</role></roles>
+        </developer>
+        <developer>
+            <id>dmg</id>
+            <name>David M Goddard</name>
+            <roles><role>PMC</role></roles>
+        </developer>
+        <developer>
+            <id>phaumer</id>
+            <name>Peter Haumer</name>
+            <roles><role>PMC</role></roles>
+        </developer>
+        <developer>
+            <id>yidonguk</id>
+            <name>Raphi D Lee</name>
+            <roles><role>PMC</role></roles>
+        </developer>
+    </developers>
+</project>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message